Open jstaro opened 6 years ago
It appears loaders
has been deprecated with Vue v2.x:
https://vue-loader.vuejs.org/migrating.html#options-deprecation
(it says loader
, but reading the rest of the doc + the new Options Reference makes it clear that it should no longer be used).
Installing vue-loader@13.0.5
and downgrading electron-webpack
to electron-webpack@1.13.0
worked for me, but i had to use an old webpack version like webpack@3.11.0
.
I got similar error. Reproduction steps:
$ mkdir project && cd project
$ curl -fsSL https://github.com/electron-userland/electron-webpack-quick-start/archive/master.tar.gz | tar -xz --strip-components 1
$ yarn
$ yarn add vue electron-webpack-vue --dev
src/renderer/index.js
:require('./App.vue');
src/renderer/App.vue
:<template> <div>Hello world!</div> </template> <script> export default {}; </script>
yarn dev
and get an error:ERROR in ./src/renderer/App.vue?vue&type=template&id=2fa9d48e
Module parse failed: Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
|
| <div>Hello world!</div>
|
@ ./src/renderer/App.vue 1:0-81 10:2-8 11:2-17 30:4-35:6 30:65-35:5 32:16-22 33:25-40
@ ./src/renderer/index.js
@ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server css-hot-loader/hotModuleReplacement ./node_modules/electron-webpack/vue-renderer-entry.js ./src/renderer/index.js
ERROR in ./src/renderer/App.vue
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
@ ./src/renderer/index.js 1:0-20
@ multi (webpack)-dev-server/client?http://localhost:9080 webpack/hot/dev-server css-hot-loader/hotModuleReplacement ./node_modules/electron-webpack/vue-renderer-entry.js ./src/renderer/index.js
Looks like VueLoaderPlugin
is required: https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required
I installed
Then, a .vue file containing the following:
results in
Looking at
electron-webpack/out/configurators/vue.js
, I'm not sure that's correct. Is this Vue v1.4 syntax perhaps?Normally, adding a rule for
.scss
should be enough: https://vue-loader.vuejs.org/guide/pre-processors.html