Uglify JS不会在webpack中使代码丑陋吗?

时间:2019-01-18 07:05:33

标签: javascript npm webpack uglifyjs

我正在尝试使我的代码无法识别。我正在使用webpackuglify,但这并不是我想的那样。这是什么样的输出?我真的很想看到没有英文单词,也没有文件名注释。

/***/ "./app/public/wp-content/themes/rise-child/js/maker-two/helpers/constants.js":
/*!*****************************************************************************************!*\
  !*** ./app/public/wp-content/themes/rise-child/js/maker-two/helpers/constants.js ***!
  \*****************************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports.default_

这是我的webpack代码,uglify js插件看起来像正确使用了吗?在命令行中,我尝试运行webpackgulpwatch

const path = require('path'),
settings = require('./settings');

const UglifyJsPlugin = require('uglifyjs-webpack-plugin');


module.exports = {
  entry: {
    'scrollerbundled': [settings.themeLocation + "js/1.js"],
    'mapbundled': [settings.themeLocation + "js/2.js"],
    'sculptor': [settings.themeLocation + "js/3.js"]
  },
  output: {
    path: path.resolve(__dirname, settings.themeLocation + "js-dist"),
    filename: "[name].js"
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env']
          }
        }
      }
    ]
  },
  optimization: {
    minimizer: [new UglifyJsPlugin({ 
            uglifyOptions: {
                mangle: true,
                output: {
                    comments: false
                }
            },
            sourceMap: true,
            exclude: [/\.min\.js$/gi]
       })]
  },
  mode: 'development'
}

0 个答案:

没有答案