-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Cannot build using symlinks. v4.4.x #13801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
|
This looks like a variation of #13736, but the symlink makes Vite unable to match the related |
I have the same problem. I have a npm published library which I sometimes link directly into a project for faster development. Build works as long as the npm package is directly installed in node_modules but breaks as soon as I "npm link" it. |
Forcing Vite to use the tsconfig.ts (and activating experimentalDecorators there) by adding this to vite.config.ts did it for me:
See: #13736 (comment) |
Just switching to Vite 4.4.4 (where experimental decorators should be activated by default) didn't work for me btw. |
Have same issue, and this solution helped. |
vite.config.ts I solved this problem
|
Describe the bug
Build fails when adding the
src
folder using a symbolic link.In v4.3.9, it succeeds and the v4.4.x fails.
vite v4.4.3 building for production...
✓ 7 modules transformed.
✓ built in 102ms
Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
file: D:/data/test/vite-lib/src/hello-element.ts:12:0
10: * @csspart button - The button
11: /
12: @CustomElement('hello-element')
^
13: export class HelloElement extends LitElement {
14: /*
error during build:
RollupError: Unexpected character '@' (Note that you need plugins to import files that are not JavaScript)
at error (file:///D:/data/test/vite-proj/node_modules/rollup/dist/es/shared/node-entry.js:2245:30)
at Module.error (file:///D:/data/test/vite-proj/node_modules/rollup/dist/es/shared/node-entry.js:13584:16)
at Module.tryParse (file:///D:/data/test/vite-proj/node_modules/rollup/dist/es/shared/node-entry.js:14310:25)
at Module.setSource (file:///D:/data/test/vite-proj/node_modules/rollup/dist/es/shared/node-entry.js:13911:39)
at ModuleLoader.addModuleSource (file:///D:/data/test/vite-proj/node_modules/rollup/dist/es/shared/node-entry.js:24439:20)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Reproduction
https://stackblitz.com/edit/vitejs-vite-nfqpju?file=index.html&terminal=dev
Steps to reproduce
1. Create two projects.
One is a public library, and the other is a project that uses the library.
2. Configure a symlink to configure the development environment.
3. Rename:
vite-lib/src/my-element.ts
For the sake of experimentation, I renamed
my-element
invite-lib
. I also changed thehello-element
class name fromMyElement
toHelloElement
.4. Using the library in vite-proj
Now, to use the library, include it in my element.
5. Run after build
Fails.
An error message is displayed.
6. Change the version.
Execute
On v4.3.9, this succeeds.
Fails in v4.4.x.
// I was unable to experiment with symlinks on stackblitz.com.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: