加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
webpack.rules.js 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
const path = require("path");
module.exports = [
{
test: /\/.+\.(node)$/,
use: "node-loader",
},
{
test: /\.(m?js|node)$/,
parser: { amd: false },
use: {
loader: "@vercel/webpack-asset-relocator-loader",
options: {
outputAssetBase: "./",
},
},
},
{
test: /\.jsx?$/,
use: {
loader: "babel-loader",
options: {
exclude: /node_modules/,
presets: ["@babel/preset-react"],
},
},
},
{
test: /\.css$/,
use: [{ loader: "style-loader" }, { loader: "css-loader" }],
},
{
test: /\.less$/,
use: [
{ loader: "style-loader" },
{ loader: "css-loader" },
{
loader: "less-loader",
options: { javascriptEnabled: true, sourceMap: false },
},
{
loader: "style-resources-loader",
options: {
patterns: path.resolve(__dirname, "src/assets/css/var.less"), //全局引入less 文件
},
},
],
},
{
test: /\.tsx?$|\.jsx$/,
exclude: /(node_modules|\.webpack)/,
use: {
loader: "ts-loader",
options: {
transpileOnly: true,
},
},
},
];
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化