【发布时间】:2017-08-04 04:19:21
【问题描述】:
我有一个包含 Webpack 2、PostCSS、ES2015 (Babel) 和 Jest 的项目。
现在,所有 ES2015 都在 src/index.js 上正常工作,文件直接连接到 src/index.js。
但在某些文件中它会破坏代码。例如,在mixins/index.js,我有这个:
const postcss = require('postcss');
当我把它改成这样时:
import postcss from 'postcss';
它会抛出这个错误:
模块构建失败:SyntaxError: Unexpected reserved word
postcss.config.js 也是如此。
我在 Webpack 配置中缺少什么以使其正常工作?
您可以查看repository here。这些是我谈到的文件:postcss.config.js 和 mixins/index.js
【问题讨论】:
标签: javascript babeljs webpack-2 postcss