1 Star 0 Fork 7

gs_ly / amis-editor-umd

forked from ayhome / amis-editor-umd 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
ayhome 提交于 2022-02-20 23:33 . amis-editor 4.0.2-beta.4
const path = require('path')
const CompressionPlugin = require("compression-webpack-plugin")
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
productionSourceMap: false,
pages: {
index: {
entry: 'examples/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
chainWebpack: config => {
if (process.env.BUILD_TARGET === "lib") {
config.plugin('compressionPlugin')
.use(new CompressionPlugin({
algorithm: 'gzip',//开启gzip
test: /\.js$|\.html$|\.css/, // 匹配文件名
threshold: 10240, // 对超过10k的数据压缩
deleteOriginalAssets: false // 不删除源文件
}))
config.plugins.push(
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false,
drop_debugger: true, // 注释console
drop_console: true,
pure_funcs: ['console.log'] // 移除console
},
},
sourceMap: false,
parallel: true,
}),
);
config.devtool = false,
config.externals = {
'vue': 'Vue',
'axios': 'axios',
'amis': 'amis',
'element-ui': 'ELEMENT'
}
}
config.module
.rule('js')
.include
.add(resolve('packages'))
.end()
.use('bable')
.loader('bable-loader')
.tap(options => {
return options
})
}
}
JavaScript
1
https://gitee.com/gs_ly/amis-editor-umd.git
git@gitee.com:gs_ly/amis-editor-umd.git
gs_ly
amis-editor-umd
amis-editor-umd
main

搜索帮助