简体   繁体   English

从Webpack 1迁移到Webpack 2

[英]Migration from Webpack 1 to Webpack 2

I'm currently migrating Webpack1 to the second version. 我目前正在将Webpack1迁移到第二个版本。 As I saw here , 我在这里看到

"Webpack is now using Postcss and cssnano in CSS-loader." “ Webpack现在在CSS-loader中使用Postcss和cssnano。”

  • That means that I don't need to install postcss-loader? 这意味着我不需要安装postcss-loader?
  • In my old Webpack.config.js file I have this: 在我的旧Webpack.config.js文件中,我有以下内容:

 webpackConfig.postcss = [ cssnano({ autoprefixer : { add : true, remove : true, browsers : ['last 5 versions'] }, discardComments : { removeAll : true }, discardUnused : false, mergeIdents : false, reduceIdents : false, safe : true, sourcemap : true }) ]; 

How do I use those options in the new Webpack 2? 如何在新的Webpack 2中使用这些选项?

You could pass in the 'mimimize' option to css-loader 您可以将'mimimize'选项传递给css-loader

...
    loader: 'css-loader',
    options: {
        minimize: true,
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM