You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
1, run project it`s work
2, copy _node_modules/my-lib to node_modules (simulated npm i mylib)
3, In src/main.js comment out 6 line and uncommenting 10 line
4, run project you will see error
I'm assuming you add spark-md5 to optimizeDeps.include, which made it work. The reason it doesn't work out-of-the-box is because Vite doesn't handle Vue files in third-party libraries currently, similar to #3910. A workaround for now is to have my-lib pre-compile Vue files to JS so that everything can be bundled.
Until Vite or plugin-vue supports Vue files in libraries (which is possible with #6801 though experimental), the workaround is actually the expected behaviour. I'll close this at the meantime so we can track in #3910 instead.
Describe the bug
I write a lib
if it in project it`s work
but if i publish to npm and install it
it cannot import other modules
Reproduction
https://github.com/scx567888/error-example1
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: