1 Star 1 Fork 0

pipe / webpack_opt

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
webpack.config.js 1.48 KB
一键复制 编辑 原始数据 按行查看 历史
pipe 提交于 2021-10-09 11:20 . add: SplitChunksPlugin
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const HappyPack = require("happypack");
const webpack = require("webpack");
module.exports = {
mode: "production", // production development
entry: {
app1:'./src/SplitChunksPlugin/app1.js',
app2:'./src/SplitChunksPlugin/app2.js'
},
// devtool: "source-map",
output: {
filename: "js/[name].[contenthash:8].bundel.js",
path: path.resolve(__dirname, "dist"),
},
devServer: {
port: 3000,
open: true,
},
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: [".ts", ".tsx", ".js"],
},
module: {
noParse: /jquery|lodash/,
rules: [
{
test: /\.m?js$/,
exclude: /node_modules/,
use: "happypack/loader",
},
{ test: /\.ts?$/, loader: "ts-loader" },
],
},
plugins: [
new HtmlWebpackPlugin({
title: "webpackopt",
template: "./public/index.html",
}),
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ["**/*", "!dll/**"],
}),
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
// new webpack.DllReferencePlugin({
// manifest: path.resolve(__dirname, "dist", "dll/manifest.json"),
// }),
new HappyPack({
threads: 4,
loaders: ["babel-loader"],
}),
],
};
1
https://gitee.com/pipepandafeng/webpack_opt.git
git@gitee.com:pipepandafeng/webpack_opt.git
pipepandafeng
webpack_opt
webpack_opt
master

搜索帮助