question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Take commented out code as import

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v14.17.4
  • Nuxt Version: 3.0.0-rc.1
  • Package Manager: yarn@1.22.18
  • Builder: vite
  • User Config: components, srcDir, buildModules, css, build, alias, meta, app, vite, router, typescript, runtimeConfig, modules, sitemap
  • Runtime Modules: ~/modules/sitemap
  • Build Modules: `@pinia/nuxt@0.1.8

Reproduction

N/A

Describe the bug

I commented out this function in composables/utils.ts image

However, it seems like Nuxt still takes it as an import (composables auto imports). After I delete the code, it works fine. image

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
aazvfcommented, May 17, 2022

I think I have the same problem on my machine.

@Lyokolux I tried reproducing on stackblitz but it’s not triggering

I can reproduce it on my local machine quite simply

npx nuxi init freshapp
cd freshapp && npm install
mkdir composables
nano composables/use-things.ts

The composable file simply contains the commented code

// export function useNotThings

After starting npm run dev I can now see in the terminal

Screenshot from 2022-05-17 14-59-46


Linux machine 5.4.0-107-generic #121-Ubuntu SMP Thu Mar 24 16:04:27 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Nuxt project info:


  • Operating System: Linux
  • Node Version: v17.8.0
  • Nuxt Version: 3.0.0-rc.3
  • Package Manager: npm@8.5.5
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

The problematic line in the file imports.mjs is

export { useNotThings } from '/mnt/slowdata/projects/current/nuxt/freshapp/composables/use-things';

Changing the comment also changes this import, putting a typo in export function prevents the bug from happening. It was this effect which finally confirmed for me what was going wrong in my project. As I said, this didn’t reproduce on stackblitz, surely there’s something @potatozerg and I have in common if others haven’t reported this by now. For now I’ll give a little extra attention to what I’m commenting out.

0reactions
Lyokoluxcommented, May 9, 2022

I tried other functions and experienced the same issue. Maybe this is just for me?

Can you try to provide a reproduction on Stackblitz close to your code ? This should however not happen 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Import jumps on to comment line when there is a comment #26
Given the following code block, if you run scalafix it will cause the second import to jump up a line resulting in it...
Read more >
Why did Python3 execute a piece of commented-out code?
I confirmed my hypothesis from the comments, with a file like: import time def dont_run(): raise Exception("oh no i ran it") time.sleep(10) ...
Read more >
commenting blocks of code removes import statements
When I uncomment the block of code I'm forced to add all the import statements again.
Read more >
Writing Comments in Python (Guide)
Learn how to write Python comments that are clean, concise, and useful. Quickly get up to speed on what the best practices are,...
Read more >
Best practices for writing code comments - Stack Overflow Blog
Rule 4: Comments should dispel confusion, not cause it. Rule 5: Explain unidiomatic code in comments. Rule 6: Provide links to the original ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found