自从plugin这块,就一直报这个错是怎么回事啊,亲人们

来源:2-3 webpack-dev-server的配置和使用

慕粉3434613

2018-06-06 09:45

D:\xp\htdocs\VUE-SSR-TECH>npm run dev


> vue-ssr-tech@1.0.0 dev D:\xp\htdocs\VUE-SSR-TECH

> cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js


i 「wds」: Project is running at http://localhost:8080/

i 「wds」: webpack output is served from /

× 「wdm」: Hash: 21932e50bbbe36ef8528

Version: webpack 4.11.0

Time: 4537ms

Built at: 2018-06-06 09:38:37

 1 asset

Entrypoint main = main.js

 [2] ./src/app.vue 184 bytes {0} [built] [failed] [1 error]

 [3] ./node_modules/vue/dist/vue.runtime.esm.js 207 KiB {0} [built]

 [4] ./src/assets/images/bg.jpg 177 bytes {0} [built] [failed] [1 error]

 [5] ./src/assets/styles/test-stylus.styl 0 bytes {0} [built]

 [6] ./src/assets/styles/test.css 224 bytes {0} [built] [failed] [1 error]

[10] ./src/index.js 382 bytes {0} [built]

[12] (webpack)/hot/emitter.js 77 bytes {0} [built]

[14] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {0} [built]

[19] (webpack)-dev-server/client/overlay.js 3.58 KiB {0} [built]

[21] (webpack)-dev-server/client/socket.js 1.05 KiB {0} [built]

[22] ./node_modules/loglevel/lib/loglevel.js 7.68 KiB {0} [built]

[24] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]

[31] ./node_modules/url/url.js 22.8 KiB {0} [built]

[32] (webpack)-dev-server/client?http://localhost:8080 7.75 KiB {0} [built]

[33] multi (webpack)-dev-server/client?http://localhost:8080 ./src 40 bytes {0} [built]

    + 19 hidden modules


WARNING in configuration

The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.

You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/


ERROR in ./src/assets/images/bg.jpg 1:0

Module parse failed: Unexpected character '�' (1:0)

You may need an appropriate loader to handle this file type.

(Source code omitted for this binary file)

 @ ./src/index.js 7:0-31

 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src


ERROR in ./src/app.vue 1:0

Module parse failed: Unexpected token (1:0)

You may need an appropriate loader to handle this file type.

> <template>

| <div id="text">{{text}}</div>

 @ ./src/index.js 3:0-27 14:20-23

 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src


ERROR in ./src/assets/styles/test.css 1:4

Module parse failed: Unexpected token (1:4)

You may need an appropriate loader to handle this file type.

> body{

|     color: rebeccapurple;

|     background-image: url("../images/done.svg") ;

 @ ./src/index.js 5:0-33

 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src

i 「wdm」: Failed to compile.

终止批处理操作吗(Y/N)? y


D:\xp\htdocs\VUE-SSR-TECH>npm i vue-loader

npm WARN vue-ssr-tech@1.0.0 No description

npm WARN vue-ssr-tech@1.0.0 No repository field.

npm WARN vue-ssr-tech@1.0.0 scripts['server'] should probably be scripts['start'].

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})


+ vue-loader@15.2.4

updated 1 package in 12.565s


D:\xp\htdocs\VUE-SSR-TECH>npm run dev


> vue-ssr-tech@1.0.0 dev D:\xp\htdocs\VUE-SSR-TECH

> cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js


i 「wds」: Project is running at http://localhost:8080/

i 「wds」: webpack output is served from /

× 「wdm」: Hash: 21932e50bbbe36ef8528

Version: webpack 4.11.0

Time: 825ms

Built at: 2018-06-06 09:42:50

 1 asset

Entrypoint main = main.js

 [2] ./src/app.vue 184 bytes {0} [built] [failed] [1 error]

 [3] ./node_modules/vue/dist/vue.runtime.esm.js 207 KiB {0} [built]

 [4] ./src/assets/images/bg.jpg 177 bytes {0} [built] [failed] [1 error]

 [5] ./src/assets/styles/test-stylus.styl 0 bytes {0} [built]

 [6] ./src/assets/styles/test.css 224 bytes {0} [built] [failed] [1 error]

[10] ./src/index.js 382 bytes {0} [built]

[12] (webpack)/hot/emitter.js 77 bytes {0} [built]

[14] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {0} [built]

[19] (webpack)-dev-server/client/overlay.js 3.58 KiB {0} [built]

[21] (webpack)-dev-server/client/socket.js 1.05 KiB {0} [built]

[22] ./node_modules/loglevel/lib/loglevel.js 7.68 KiB {0} [built]

[24] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]

[31] ./node_modules/url/url.js 22.8 KiB {0} [built]

[32] (webpack)-dev-server/client?http://localhost:8080 7.75 KiB {0} [built]

[33] multi (webpack)-dev-server/client?http://localhost:8080 ./src 40 bytes {0} [built]

    + 19 hidden modules


WARNING in configuration

The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.

You can also set it to 'none' to disable any default behavior. Learn more: https://webpack.js.org/concepts/mode/


ERROR in ./src/assets/images/bg.jpg 1:0

Module parse failed: Unexpected character '�' (1:0)

You may need an appropriate loader to handle this file type.

(Source code omitted for this binary file)

 @ ./src/index.js 7:0-31

 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src


ERROR in ./src/app.vue 1:0

Module parse failed: Unexpected token (1:0)

You may need an appropriate loader to handle this file type.

> <template>

| <div id="text">{{text}}</div>

 @ ./src/index.js 3:0-27 14:20-23

 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src


ERROR in ./src/assets/styles/test.css 1:4

Module parse failed: Unexpected token (1:4)

You may need an appropriate loader to handle this file type.

> body{

|     color: rebeccapurple;

|     background-image: url("../images/done.svg") ;

 @ ./src/index.js 5:0-33

 @ multi (webpack)-dev-server/client?http://localhost:8080 ./src

i 「wdm」: Failed to compile.


写回答 关注

2回答

  • 慕数据3408171
    2018-07-30 10:11:50

    我遇到类似问题:

    [29] ./App.vue 257 bytes {0} [built] [failed] [1 error]

        + 15 hidden modules


    ERROR in ./App.vue

    Module build failed (from ./node_modules/vue-loader/index.js):

    TypeError: Cannot read property 'vue' of undefined

        at Object.module.exports (E:\studyAndPrictice\Vue\vue-loader-demo\node_modules\vue-loader\lib\loader.js:31:42)

     @ ./main.js 7:11-31

     @ multi (webpack)-dev-server/client?http://localhost:8082 (webpack)/hot/dev-server.js ./main.js

    请问大神们如何解决

  • 慕粉3912077
    2018-06-07 15:00:15
    1.安装了style-loader和css-loader、url-loader?
    2.module的rules对应的test有加svg和jpg类型?
    3.index.js引入的图片路径后面是不是加多了什么?
    4.你的页面本来就有或有新建body这标签?

Vue+Webpack打造todo应用

用前端最热门框架Vue+最火打包工具Webpack打造todo应用

84606 学习 · 787 问题

查看课程

相似问题