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.

vite build using old cached source file?

See original GitHub issue

Describe the bug

I had an unterminated string constant in a Vue file.

As expected, the ‘server.hmr.overlay’ showed the error and the line that caused it…

[plugin:vite:eslint] C:\myproject\src\pages\LoginPage.vue
  59:11  error  Parsing error: Unterminated string constant. (49:11)

✖ 1 problem (1 error, 0 warnings)
C:/myproject/src/pages/LoginPage.vue
    at formatError (C:\myproject\node_modules\vite\dist\node\chunks\dep-f9d9421a.js:38082:46)
    at TransformContext.error (C:\myproject\node_modules\vite\dist\node\chunks\dep-f9d9421a.js:38078:19)
    at TransformContext.transform (C:\myproject\node_modules\vite-plugin-eslint\dist\index.js:87:14)
    at async Object.transform (C:\myproject\node_modules\vite\dist\node\chunks\dep-f9d9421a.js:38318:30)
    at async doTransform (C:\myproject\node_modules\vite\dist\node\chunks\dep-f9d9421a.js:53014:29
Click outside or fix the code to dismiss.

I fixed the error and saved the file.

The same error was displayed again.

In attempting to resolve this, I edited the file a number of times and stopped and started the vite process.

Two ways to resolve the issue:

  • copy the file content to a new file with the same name, replacing the old file
  • rename the file and update code to reference the renamed new file

Reproduction

Not possible.

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 14.45 GB / 31.83 GB
  Binaries:
    Node: 16.13.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 98.0.4758.102
    Edge: Spartan (44.19041.1266.0), Chromium (98.0.1108.55)
    Internet Explorer: 11.0.19041.1202

Used Package Manager

npm

Logs

Log lines included in the description above.

Validations

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
glittlecommented, Mar 5, 2022

Yes, I understand. We can let this be closed. I’ve got a workaround for when it happens again. And if someone else encounters the same issue, maybe this report will be a another clue to help identify the cause.

If the build system doesn’t do any caching, then maybe there was some glitch in the environment. If there is any sort of caching, maybe it should be reviewed to ensure that this can’t happen.

Thanks, @bluwy, for carrying forward the conversation. As mentioned, I’m fine with letting this issue be closed.

1reaction
bluwycommented, Mar 5, 2022

If there’s no repro, there’s no way for us to fix it. The behaviour described alone isn’t enough to figure the source of the bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building for Production - Vite
cache.reset() needs to be called at buildStart for build watch mode to work correctly in this case. Rebuild on files changes #. You...
Read more >
Dependency Pre-Bundling - Vite
If an existing cache is not found, Vite will crawl your source code and automatically discover dependency imports (i.e. "bare imports" that expect...
Read more >
Configuring Vite
Directory to save cache files. Files in this directory are pre-bundled deps or some other cache files generated by vite, which can improve...
Read more >
Features | Vite
Vite will detect such bare module imports in all served source files and perform the following: Pre-bundle them to improve page loading speed...
Read more >
Shared Options | Vite
Files in this directory are pre-bundled deps or some other cache files generated by vite, which can improve the performance. You can use...
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