1 Star 0 Fork 0

小么康/图表配置

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.common.js 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
小么康 提交于 2022-09-01 16:27 . fix: webpack配置文件拆分
const path = require("path");
const webpack = require("webpack");
const { CleanWebpackPlugin } = require("clean-webpack-plugin"); //注意引入写法
const HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
entry: {
index: "./src/index.js",
},
output: {
filename: "[name].[contenthash].js",
path: path.resolve(__dirname, "build"),
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.(png|svg|jpg|gif)$/,
loader: "url-loader",
options: {
// limit: 10000,
name: "img/[name].[hash:7].[ext]",
},
},
{
test: /\.(js|jsx)$/,
use: "babel-loader",
exclude: /node_modules/,
},
],
},
plugins: [
new CleanWebpackPlugin(),
// HtmlWebpackPlugin插件功能:内存中生成html页面和打包页面并将打包好的js正确放入html页面中
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "public/index.html"),
filename: "index.html",
}),
],
resolve: {
alias: {
"@": path.resolve(__dirname, "src"),
},
},
optimization: {
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/,
name: "vendor",
chunks: "all",
},
},
},
},
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiao-mokang/echart-config.git
git@gitee.com:xiao-mokang/echart-config.git
xiao-mokang
echart-config
图表配置
master

搜索帮助