Error compiling components when Vue 2 is installed in main package.json #4678
-
Description:This is issue is related to discussion #4549, but I'm creating an issue as I was able to make a reproduction repo. When Vue 2 is installed in the main package.json of the laravel app, nova components compilation fails with the following error: Detailed steps to reproduce the issue on a fresh Nova installation:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
This comment has been hidden.
This comment has been hidden.
-
After some additional research, this is due to This can be solved by adding the following: npm uninstall "@vue/compiler-sfc"
npm install -D "vue" Example: nova-issues/issue-4595@e56d8af There could be side-effect on requiring |
Beta Was this translation helpful? Give feedback.
After some additional research, this is due to
vue-loader
trying to userequire('vue/compiler-sfc')
insteads ofrequire('@vue/compiler-sfc')
which is required directly in the template. https://github.com/vuejs/vue-loader/blob/6a293dff5f2ed3167eb3b448f1d714091185a44e/src/compiler.ts#L12-L25This can be solved by adding the following:
Example: nova-issues/issue-4595@e56d8af
There could be side-effect on requiring
vue
directly (the generated dist are slightly larger with more code) but I can't find any error at the moment. Best to first try withnpm run dev
and tests it out before usingnpm run prod
.