Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请教一个有关build/webpack.dev.conf.js的配置问题 #92

Open
draculavlad opened this issue Aug 13, 2017 · 1 comment
Open

请教一个有关build/webpack.dev.conf.js的配置问题 #92

draculavlad opened this issue Aug 13, 2017 · 1 comment

Comments

@draculavlad
Copy link

vue-cli默认生成的的此文件中会在合并webpack.base.conf.js配置时引入
module: {
rules: utils.styleLoaders({sourceMap: config.dev.cssSourceMap})
}
如果我在使用这个配置的时候会爆Module build failed的Error,但如果参照你的文件删除这个配置,问题就解决了,按照文档上来说这项配置是定义“配置样式文件的处理规则的styleLoaders”,是不是在此文件中配置这个module会把webpack.base.conf.js中的此项配置给覆盖掉?

@leemove
Copy link

leemove commented Oct 20, 2017

你说的是这一段吗

module.exports = merge(baseWebpackConfig, {
  module: {
    rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
  },
  // cheap-module-eval-source-map is faster for development
  devtool: '#cheap-module-eval-source-map',
  plugins: [
    new webpack.DefinePlugin({
      'process.env': config.dev.env
    }),
    // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
    new webpack.HotModuleReplacementPlugin(),
    new webpack.NoEmitOnErrorsPlugin(),
    // https://github.com/ampedandwired/html-webpack-plugin
    new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'index.html',
      inject: true
    }),
    new FriendlyErrorsPlugin()
  ]
})

这个Merge函数就是引入的webpack-merge你可以看看这个包,合并配置用的.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants