0

自从将 babel-plugin-react-css-modules 从 2.8.0 升级到 3.3.2 以来,我已经开始收到错误:

> node ./server.js

Listening at ipmc-dev11.be-md.ncbi.nlm.nih.gov:3000
Hash: a9c93503d372d94f4710
Version: webpack 3.8.1
Time: 2752ms
                           Asset    Size  Chunks  Chunk Names
    main-a9c93503d372d94f4710.js  575 kB       0  main
main-a9c93503d372d94f4710.js.map  703 kB       0  main
  [19] (webpack)/hot/log.js 1 kB {0} [built]
  [29] (webpack)/hot/emitter.js 75 bytes {0} [built]
  [57] multi webpack-dev-server/client?http://ipmc-dev11.be-md.ncbi.nlm.nih.gov:3000 webpack/hot/only-dev-server react-hot-loader/patch ./assets/index 64 bytes {0} [built]
  [58] (webpack)-dev-server/client?http://ipmc-dev11.be-md.ncbi.nlm.nih.gov:3000 7.95 kB {0} [built]
  [59] ./node_modules/url/url.js 23.3 kB {0} [built]
  [65] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
  [67] ./node_modules/loglevel/lib/loglevel.js 7.74 kB {0} [built]
  [68] (webpack)-dev-server/client/socket.js 1.05 kB {0} [built]
  [70] (webpack)-dev-server/client/overlay.js 3.73 kB {0} [built]
  [75] (webpack)/hot nonrecursive ^\.\/log$ 170 bytes {0} [built]
  [77] (webpack)/hot/only-dev-server.js 2.3 kB {0} [built]
  [78] (webpack)/hot/log-apply-result.js 1.27 kB {0} [built]
  [79] ./node_modules/react-hot-loader/patch.js 41 bytes {0} [built]
  [80] ./node_modules/react-hot-loader/lib/patch.js 209 bytes {0} [built]
 [197] ./assets/index.jsx 617 bytes {0} [built] [failed] [1 error]
    + 183 hidden modules

ERROR in ./assets/index.jsx
Module build failed: SyntaxError: Unexpected token ...
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/shifrinb2/submission_ui/node_modules/babel-plugin-react-css-modules/dist/index.js:37:25)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
 @ multi webpack-dev-server/client?http://ipmc-dev11.be-md.ncbi.nlm.nih.gov:3000 webpack/hot/only-dev-server react-hot-loader/patch ./assets/index
webpack: Failed to compile.

babel-plugin-react-css-modules 配置为使用 babel-loader,webpack 配置:

module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules\/(?!(pretty-bytes|babel-plugin-react-css-modules))/, use: [{loader: 'babel-loader'}], },

我是否需要调整其他内容才能使用新版本?

4

1 回答 1

1

问题出在node版本上,升级到6.10.3解决了

于 2018-01-09T22:39:42.450 回答