2 Star 0 Fork 1

杨鑫/quickedit-web

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.config.js 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
kay 提交于 2020-06-08 06:03 . 快编系统架子
var path = require('path');
var ROOT_PATH = path.resolve(__dirname);
var APP_PATH = path.resolve(ROOT_PATH, 'src/');
var webpack=require('webpack');
var CompressionWebpackPlugin = require('compression-webpack-plugin');
const vendors = [
'react',
'react-dom',
'react-redux',
'react-router',
'react-router-redux',
'redux',
];
//将jquery单独打包,将react的相关组件单独打包
module.exports = function (webpackConfig, env) {
webpackConfig.entry={
"index": "./src/index.js",
serve: "./src/serve-config.js",
vendor: vendors,
jquery:["jquery"]
}
webpackConfig.plugins.push(new CompressionWebpackPlugin({ //gzip 压缩
asset: '[path].gz[query]',
algorithm: 'gzip',
test: new RegExp(
'\\.(js|css)$' //压缩 js 与 css
),
threshold: 10240,
minRatio: 0.8
}));
webpackConfig.plugins.push(new webpack.optimize.CommonsChunkPlugin({
names: ["jquery","vendor"],
minChunks: Infinity
}));
webpackConfig.plugins.push(new webpack.optimize.CommonsChunkPlugin({
name: "runtime",
minChunks: Infinity
}));
webpackConfig.plugins.push(new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: 2,
}),);
return webpackConfig;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/yangxin123/quickedit-web.git
[email protected]:yangxin123/quickedit-web.git
yangxin123
quickedit-web
quickedit-web
master

搜索帮助