vite build using old cached source file?
See original GitHub issueDescribe 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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.