锦水三维代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.9 KiB

const path = require("path");
//const isMinify = process.env.MINIFY
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const JavaScriptObfuscator = require('webpack-obfuscator')
module.exports = {
// 出口对象中,属性为输出的js文件名,属性值为入口文件
entry: ["./public/map/shenzhen/js-0622-2/index.js"], //入口文件,从项目根目录指定
// entry: ["./public/map/js-hd0622/index.js"], //入口文件,从项目根目录指定
output: { //输出路径和文件名,使用path模块resolve方法将输出路径解析为绝对路径
path: path.resolve(__dirname, "./public/map/shenzhen/js-0622-2/out/"), //将js文件打包到dist/js的目录
// path: path.resolve(__dirname, "./public/map/js-hd0622/out/"), //将js文件打包到dist/js的目录
filename: "globe.js",
library: "cg",
libraryTarget: "umd",
},
devtool: 'cheap-source-map',
mode: 'development',
// mode: 'production',
optimization: {
minimize: true,
minimizer: [
new UglifyJSPlugin({
// test: /\.js($|\?)/i,
// sourceMap: true,
// uglifyOptions: {
// ie8: true,
// ecma: 6,
// mangle: true,
// compress: true,
// warnings: false
// }
})
]
},
module: {
rules: [{ // 这里用rules而不是loaders
test: /\.js$/, // 匹配所有js文件
exclude: /node_modules/, // 排除掉node_modules这个文件夹的js文件
loader: 'babel-loader', // 加载babel工具包
options: { // 这里用options而不是query,虽然可以兼容,但是还是按照规则来吧
presets: ['env'] // 使用es6工具包
}
}]
},
plugins: [
new JavaScriptObfuscator({
rotateUnicodeArray: true
}, [])
]
}