1 Star 0 Fork 1

auth-x/authing.js

forked from Authi.ng/authing.js 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
ivy 提交于 2019-05-19 15:32 +08:00 . Fixed webpack entry file
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
// const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const nodeConfig = {
target: 'node',
mode: 'development',
entry: './src/index.js',
output: {
libraryTarget: 'umd',
path: `${__dirname}/dist`,
filename: 'authing-js-sdk.js'
},
module: {
rules: [{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['env', 'stage-0'] // env --> es6, stage-0 --> es7, react --> react
}
},
exclude: /node_modules/
}]
}
};
const webConfig = {
target: 'web',
mode: 'development',
entry: './src/index.js',
output: {
libraryTarget: 'umd',
path: `${__dirname}/dist`,
filename: 'authing-js-sdk-browser.js',
library: 'Authing'
},
module: {
rules: [{
test: /\.json$/,
use: 'json-loader',
exclude: /node_modules/
},
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['env', 'stage-0'] // env --> es6, stage-0 --> es7, react --> react
}
},
exclude: /node_modules/
}
]
}
};
const webMinConfig = {
target: 'web',
mode: 'production',
entry: './src/index.js',
output: {
libraryTarget: 'umd',
path: `${__dirname}/dist`,
filename: 'authing-js-sdk-browser.min.js',
library: 'Authing'
},
module: {
rules: [{
test: /\.json$/,
use: 'json-loader',
exclude: /node_modules/
},
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['env', 'stage-0'] // env --> es6, stage-0 --> es7, react --> react
}
},
exclude: /node_modules/
}
]
},
optimization: {
minimizer: [
// new BundleAnalyzerPlugin(), // 打包后可查看各种包大小
new UglifyJsPlugin({
uglifyOptions: {
compress: {
// 在UglifyJs删除没有用到的代码时不输出警告
warnings: false,
// 删除所有的 `console` 语句,可以兼容ie浏览器
drop_console: true,
// 内嵌定义了但是只用到一次的变量
collapse_vars: true,
// 提取出出现多次但是没有定义成变量去引用的静态值
reduce_vars: true
},
output: {
// 最紧凑的输出
beautify: false,
// 删除所有的注释
comments: false
}
}
})
]
}
};
module.exports = [nodeConfig, webConfig, webMinConfig];
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/gf-authing/authing.js.git
git@gitee.com:gf-authing/authing.js.git
gf-authing
authing.js
authing.js
next

搜索帮助