2023-08-22 06:37:04 +02:00
|
|
|
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
|
|
const LodashModuleReplacementPlugin = require("lodash-webpack-plugin");
|
2022-06-08 02:25:35 +02:00
|
|
|
const path = require("path");
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
mode: "development",
|
|
|
|
entry: {
|
2023-09-24 06:05:06 +02:00
|
|
|
prompt: ["./src/index.ts", "./src/index.less"],
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve(__dirname, "dist"),
|
2022-11-02 05:18:40 +01:00
|
|
|
filename: "[name].js",
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: /\.tsx?$/,
|
|
|
|
// exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: "babel-loader",
|
|
|
|
options: {
|
|
|
|
presets: [
|
|
|
|
[
|
|
|
|
"@babel/preset-env",
|
|
|
|
{
|
2023-08-22 06:37:04 +02:00
|
|
|
targets:
|
|
|
|
"defaults and not ie > 0 and not op_mini all and not op_mob > 0 and not kaios > 0 and not and_qq > 0 and not and_uc > 0 and not baidu > 0",
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
"@babel/preset-react",
|
2023-08-22 06:37:04 +02:00
|
|
|
"@babel/preset-typescript",
|
|
|
|
],
|
2022-06-08 02:25:35 +02:00
|
|
|
plugins: [
|
2023-08-22 06:37:04 +02:00
|
|
|
["@babel/transform-runtime", { regenerator: true }],
|
2022-06-08 02:25:35 +02:00
|
|
|
"@babel/plugin-transform-react-jsx",
|
2023-08-22 06:37:04 +02:00
|
|
|
["@babel/plugin-proposal-decorators", { legacy: true }],
|
|
|
|
["@babel/plugin-proposal-class-properties", { loose: true }],
|
|
|
|
["@babel/plugin-proposal-private-methods", { loose: true }],
|
|
|
|
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
2022-06-08 02:25:35 +02:00
|
|
|
"babel-plugin-jsx-control-statements",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/,
|
2023-08-22 06:37:04 +02:00
|
|
|
use: ["style-loader", "css-loader"],
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.less$/,
|
2023-08-22 06:37:04 +02:00
|
|
|
use: [{ loader: MiniCssExtractPlugin.loader }, "css-loader", "less-loader"],
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
2023-08-22 06:37:04 +02:00
|
|
|
],
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
2023-08-22 06:37:04 +02:00
|
|
|
new MiniCssExtractPlugin({ filename: "[name].css", ignoreOrder: true }),
|
2022-11-02 05:18:40 +01:00
|
|
|
new LodashModuleReplacementPlugin(),
|
2022-06-08 02:25:35 +02:00
|
|
|
],
|
|
|
|
resolve: {
|
2023-08-22 06:37:04 +02:00
|
|
|
extensions: [".ts", ".tsx", ".js", ".mjs", ".cjs", ".wasm", ".json", ".less", ".css"],
|
2022-06-08 02:25:35 +02:00
|
|
|
},
|
2023-01-17 18:59:31 +01:00
|
|
|
};
|