加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
webpack.common.js 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
tiger 提交于 2024-08-26 17:49 . init
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = {
entry: {
app: path.resolve(__dirname, "src", "index.js"),
},
plugins: [
new HtmlWebpackPlugin({
title: "TodoMVC: React",
template: path.resolve(__dirname, "public", "index.html"),
}),
],
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
clean: true,
},
resolve: {
extensions: [".js", ".jsx"],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: [
["@babel/preset-env", { targets: "defaults" }],
["@babel/preset-react", { runtime: "automatic" }],
],
},
},
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: "webpack-plugin-istanbul/loader",
options: {
include: ["src/**/*.js", "src/**/*.jsx"],
exclude: ["src/**/*.spec.js"],
extension: [".js",".jsx"],
cwd: process.cwd(),
},
},
enforce: 'post',
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: "asset/resource",
},
],
},
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化