npm run build
> todolist@1.0.0 build E:\work\todoList
> webpack --config webpack.config.js
Hash: 22c25b28c8f11c65bec2
Version: webpack 4.10.2
Time: 1429ms
Built at: 2018-06-01 20:35:36
? ? Asset? ? ?Size? Chunks? ? ? ? ? ? ?Chunk Names
bundle.js? 243 KiB? ? main? [emitted]? main
Entrypoint main = bundle.js
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 489 bytes {main} [built]
[./src/app.vue] 1.07 KiB {main} [built] [1 error]
[./src/app.vue?vue&type=script&lang=js] 90 bytes {main} [built] [1 error]
[./src/app.vue?vue&type=style&index=0&lang=css] 182 bytes {main} [built] [failed] [2 errors]
[./src/app.vue?vue&type=template&id=bced26ea] 168 bytes {main} [built] [failed] [2 errors][./src/index.js] 180 bytes {main} [built]
? ? + 5 hidden modules
ERROR in ./src/app.vue?vue&type=style&index=0&lang=css
Module parse failed: Unexpected character '#' (16:0)
You may need an appropriate loader to handle this file type.
|
|
| #test{
|? ?color: red;
| }
?@ ./src/app.vue 4:0-62
?@ ./src/index.js
ERROR in ./src/app.vue?vue&type=template&id=bced26ea
Module parse failed: Unexpected token (2:0)
You may need an appropriate loader to handle this file type.
|
| <div id="test">{{text}}</div>
|
?@ ./src/app.vue 1:0-81 11:2-8 12:2-17
?@ ./src/index.js
ERROR in ./src/app.vue
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/index.js 2:0-27 8:19-22
ERROR in ./src/app.vue?vue&type=template&id=bced26ea
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/app.vue 1:0-81 11:2-8 12:2-17
?@ ./src/index.js
ERROR in ./src/app.vue?vue&type=script&lang=js
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/app.vue 2:0-54 3:0-49 3:0-49 10:2-8
?@ ./src/index.js
ERROR in ./src/app.vue?vue&type=style&index=0&lang=css
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
?@ ./src/app.vue 4:0-62
?@ ./src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! todolist@1.0.0 build: `webpack --config webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the todolist@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!? ? ?C:\Users\Tom\AppData\Roaming\npm-cache\_logs\2018-06-01T12_35_36_148Z-debug.log
2018-06-07
ERROR in ./src/app.vue
vue-loader was used without the corresponding plugin.?
只能解釋這句話的意思,缺少合適的plugin插件。說明你的vue-loader是15.x版本
三、vue-loader15 變化
https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required
1、vue-loader14及之前:僅作為loader加載
module:{
?? ?rules:[
?? ?{
?? ??? ?test:/\.vue$/,
?? ??? ?loader:'vue-loader'
? ? }
】}
2、vue-loader15 同時(shí)還需要一個(gè)Plugin == loader+plugin [loader參照之前: 沒寫loader我報(bào)錯(cuò)了]
const VueLoaderPlugin = require('vue-loader/lib/plugin')
?? ?plugins:[
?? ??? ?new VueLoaderPlugin()
?? ?]
2018-06-02
npm install?style-loader?css-loader -D
然后,將
????{
??????? test: /\.css$/,
??????? use:[
????????? 'style-loader',
????????? 'css-loader',
??????? ]
????? },
添加到webpack中的,module中試試