2023-01-27 14:07:56 +00:00
|
|
|
const path = require("path");
|
2022-09-05 10:16:04 +00:00
|
|
|
const FilterWarningsPlugin = require("webpack-filter-warnings-plugin");
|
|
|
|
|
2022-07-01 20:33:35 +00:00
|
|
|
const scriptExtensions = /\.(tsx|ts|js|jsx|mjs)$/;
|
2023-01-09 13:41:05 +00:00
|
|
|
const imageExtensions = /\.(bmp|gif|jpg|jpeg|png|ico)$/;
|
2022-07-01 20:33:35 +00:00
|
|
|
const fontsExtension = /\.(eot|otf|ttf|woff|woff2)$/;
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
resolve: {
|
|
|
|
extensions: [".js", ".jsx", ".json", ".ts", ".tsx"],
|
|
|
|
fallback: {
|
|
|
|
crypto: false,
|
|
|
|
},
|
2023-01-27 13:27:39 +00:00
|
|
|
alias: {
|
|
|
|
PUBLIC_DIR: path.resolve(__dirname, "../../../public"),
|
2023-01-31 16:23:49 +00:00
|
|
|
ASSETS_DIR: path.resolve(__dirname, "../public"),
|
2023-01-27 13:27:39 +00:00
|
|
|
SRC_DIR: path.resolve(__dirname, "../src"),
|
2023-02-03 14:48:59 +00:00
|
|
|
CLIENT_PUBLIC_DIR: path.resolve(__dirname, "../../client/public"),
|
2023-01-27 13:27:39 +00:00
|
|
|
PACKAGE_FILE: path.resolve(__dirname, "../package.json"),
|
|
|
|
},
|
2022-07-01 20:33:35 +00:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
test: scriptExtensions,
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: "babel-loader",
|
|
|
|
options: {
|
2022-08-17 07:21:43 +00:00
|
|
|
presets: [
|
|
|
|
"@babel/preset-react",
|
|
|
|
"@babel/preset-env",
|
|
|
|
"@babel/preset-typescript",
|
|
|
|
],
|
2022-07-01 20:33:35 +00:00
|
|
|
plugins: [
|
|
|
|
"@babel/plugin-transform-runtime",
|
|
|
|
"@babel/plugin-proposal-class-properties",
|
|
|
|
"@babel/plugin-proposal-export-default-from",
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: fontsExtension,
|
2023-02-02 12:16:31 +00:00
|
|
|
generator: {
|
|
|
|
emit: false,
|
|
|
|
},
|
|
|
|
type: "asset/resource",
|
2022-07-01 20:33:35 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.svg/,
|
2022-11-24 10:56:30 +00:00
|
|
|
//type: "asset/inline",
|
2023-01-12 12:39:00 +00:00
|
|
|
resourceQuery: { not: [/url/] }, // exclude react component if *.svg?url
|
2022-11-24 10:56:30 +00:00
|
|
|
use: ["@svgr/webpack"],
|
2022-07-01 20:33:35 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
test: imageExtensions,
|
2023-02-02 12:16:31 +00:00
|
|
|
generator: {
|
|
|
|
emit: false,
|
|
|
|
},
|
2022-07-01 20:33:35 +00:00
|
|
|
type: "asset/resource",
|
|
|
|
},
|
2023-01-12 12:39:00 +00:00
|
|
|
{
|
|
|
|
test: /\.svg$/i,
|
2023-02-02 12:16:31 +00:00
|
|
|
generator: {
|
|
|
|
emit: false,
|
|
|
|
},
|
2023-01-12 12:39:00 +00:00
|
|
|
type: "asset/resource",
|
|
|
|
resourceQuery: /url/, // *.svg?url
|
|
|
|
},
|
2023-01-30 16:18:31 +00:00
|
|
|
{
|
|
|
|
test: /\.json$/,
|
|
|
|
resourceQuery: { not: [/url/] }, // exclude if *.json?url,
|
|
|
|
loader: "json-loader",
|
|
|
|
type: "javascript/auto",
|
|
|
|
},
|
2022-07-01 20:33:35 +00:00
|
|
|
],
|
|
|
|
},
|
2022-09-05 10:16:04 +00:00
|
|
|
plugins: [
|
|
|
|
//ignore the drivers you don't want. This is the complete list of all drivers -- remove the suppressions for drivers you want to use.
|
|
|
|
new FilterWarningsPlugin({
|
|
|
|
exclude: [/Critical dependency/],
|
|
|
|
}),
|
|
|
|
],
|
2022-07-01 20:33:35 +00:00
|
|
|
};
|