为了账号安全,请及时绑定邮箱和手机立即绑定

webpack打包错误ERROR in ./src/page/index/index.css

webpack打包错误ERROR in ./src/page/index/index.css

慕粉3422128 2019-04-29 20:56:40
Hash: 7a7713dc8f12d5fa37faVersion: webpack 1.15.0Time: 108ms      Asset       Size  Chunks             Chunk Names js/base.js    4.37 kB       0  [emitted]  commonjs/index.js  560 bytes       1  [emitted]  indexjs/login.js  426 bytes       2  [emitted]  login   [0] multi common 28 bytes {0} [built]   [0] multi index 28 bytes {1} [built]   [0] multi login 28 bytes {2} [built]   [1] ./src/page/common/index.js 170 bytes {0} [built]   [2] ./src/page/index/index.js 192 bytes {1} [built] [1 error]   [3] ./src/page/index/index.css 0 bytes [built] [failed]   [4] ./src/page/module.js 179 bytes {0} [built]   [5] ./src/page/login/index.js 196 bytes {2} [built]ERROR in ./src/page/index/index.cssModule parse failed: C:\Users\wh\Desktop\mmall\doc\mmall-fe\src\page\index\index.css Unexpected token (8:4)You may need an appropriate loader to handle this file type.SyntaxError: Unexpected token (8:4)    at Parser.pp$4.raise (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:2221:15)    at Parser.pp.unexpected (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:603:10)    at Parser.pp.semicolon (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:581:61)    at Parser.pp$1.parseExpressionStatement (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:966:10)    at Parser.pp$1.parseStatement (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:730:24)    at Parser.pp$1.parseTopLevel (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:638:25)    at Parser.parse (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:516:17)    at Object.parse (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\acorn\dist\acorn.js:3098:39)    at Parser.parse (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\webpack\lib\Parser.js:902:15)    at NormalModule.<anonymous> (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\webpack\lib\NormalModule.js:104:16)    at NormalModule.onModuleBuild (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\webpack-core\lib\NormalModuleMixin.js:310:10)    at nextLoader (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\webpack-core\lib\NormalModuleMixin.js:275:25)    at C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\webpack-core\lib\NormalModuleMixin.js:259:5    at Storage.finished (C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)    at C:\Users\wh\Desktop\mmall\doc\mmall-fe\node_modules\graceful-fs\graceful-fs.js:90:16    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3) @ ./src/page/index/index.js 9:0-22按老师视频中进行操作,但是打包报错
查看完整描述

2 回答

?
脚扶拖拉机

TA贡献1条经验 获得超0个赞

版本问题,老师视频中在查看是否安装成功的时候能看到两个loader的版本,重新安装的时候指定为老师的版本即可

查看完整回答
反对 回复 2020-02-09
?
pardon110

TA贡献1038条经验 获得超227个赞

css相关的loader配置错误

查看完整回答
反对 回复 2019-04-30
  • 慕粉3422128
    慕粉3422128
    重新安装css-loader吗
  • 慕粉3422128
    慕粉3422128
    npm install style-loader css-loader --save-dev npm WARN css-loader@2.1.1 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + css-loader@2.1.1 + style-loader@0.23.1 added 43 packages from 59 contributors and audited 1322 packages in 13.117s found 1 low severity vulnerability run `npm audit fix` to fix them, or `npm audit` for details 安装最新版本 还是和刚刚报一样的错
  • 2 回答
  • 0 关注
  • 4151 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信