是否可以不缩小React应用中的某些特定文件

时间:2018-09-07 09:15:11

标签: reactjs webpack uglifyjs

我正在一个React项目中,我不想缩小messages.js文件。我很累在exclude: [/\.min\.js$/gi, /messages\.js$/]中添加uglifyJSPlugin,但是没有用。我不确定这是否可能。

这是我的目录结构:

 app/
   components/
     MyComponent/
        index.js
        messages.js // i don't want to minify this file in my app

这是webpack配置:

new webpack.optimize.UglifyJsPlugin({
          comments: false, // remove comments
          mangle: true,
          compress: {
            unused: true,
            dead_code: true, // big one--strip code that will never execute
            warnings: false, // Suppress uglification warnings
            pure_getters: true,
            unsafe: true,
            unsafe_comps: true,
            screw_ie8: true,
            drop_debugger: true,
            conditionals: true,
            evaluate: true,
            drop_console: true, // strips console statements
            sequences: true,
            booleans: true,
            if_return: true,
            join_vars: true,
          },
          output: {
            comments: false,
          },
          exclude: [/\.min\.js$/gi, /messages\.js$/], // skip pre-minified libs
        }),

0 个答案:

没有答案