加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.config.js 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
benweet 提交于 2018-03-14 00:22 . Fixed webpack output
/* global __dirname, require, module */
const webpack = require('webpack');
const path = require('path');
const env = require('yargs').argv.env; // use --env with webpack 2
const UglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
const plugins = [];
let outputFile;
if (env === 'build') {
plugins.push(new UglifyJsPlugin({ minimize: true }));
outputFile = 'stackedit.min.js';
} else {
outputFile = 'stackedit.js';
}
const config = {
entry: path.join(__dirname, '/src/index.js'),
devtool: 'source-map',
output: {
path: path.join(__dirname, '/docs/lib'),
filename: outputFile,
library: 'Stackedit',
libraryTarget: 'umd',
umdNamedDefine: true,
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/,
},
],
},
resolve: {
modules: [path.resolve('./node_modules'), path.resolve('./src')],
extensions: ['.json', '.js'],
},
plugins,
};
module.exports = config;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化