1 Star 0 Fork 2

lee5353/react-design-editor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.prod.js 2.44 KB
一键复制 编辑 原始数据 按行查看 历史
sgoh 提交于 2019-04-29 10:18 . added meta tags html webpack plugin
const webpack = require('webpack');
const path = require('path');
const merge = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const WorkboxPlugin = require('workbox-webpack-plugin');
const baseConfig = require('./webpack.common.js');
const pathsToClean = [
'js',
];
const cleanOptions = {
root: path.resolve(__dirname, 'public'),
verbose: true,
};
const plugins = [
// 로더들에게 옵션을 넣어주는 플러그인
new webpack.LoaderOptionsPlugin({
minimize: true,
}),
// index.html 로 의존성 파일들 inject해주는 플러그인
new HtmlWebpackPlugin({
filename: 'index.html',
title: 'React Design Editor',
meta: {
description: `React Design Editor has started to developed direct manipulation of editable design tools like Powerpoint, We've developed it with react.js, ant.design, fabric.js`,
},
}),
new WorkboxPlugin.InjectManifest({
swSrc: './src/sw.js',
swDest: 'sw.js',
}),
new CleanWebpackPlugin(pathsToClean, cleanOptions),
];
module.exports = merge(baseConfig, {
mode: 'production',
entry: {
vendor: [
'react',
'react-dom',
'lodash',
'fabric',
'antd',
],
app: ['@babel/polyfill', path.resolve(__dirname, 'src/index.js')],
},
output: {
// entry에 존재하는 app.js, vendor.js로 뽑혀 나온다.
path: path.resolve(__dirname, 'public'),
filename: 'js/[name].[chunkhash:16].js',
chunkFilename: 'js/[id].[chunkhash:16].js',
publicPath: './',
},
optimization: {
minimizer: [
// we specify a custom UglifyJsPlugin here to get source maps in production
new TerserPlugin({
cache: true,
parallel: true,
terserOptions: {
warnings: false,
compress: {
warnings: false,
unused: true, // tree shaking(export된 모듈 중 사용하지 않는 모듈은 포함하지않음)
},
ecma: 6,
mangle: true,
unused: true,
},
sourceMap: true,
}),
],
},
plugins,
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/lee5353/react-design-editor.git
git@gitee.com:lee5353/react-design-editor.git
lee5353
react-design-editor
react-design-editor
master

搜索帮助