2019-12-02 15:26:31 +00:00
|
|
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
2019-08-27 11:02:47 +00:00
|
|
|
const path = require("path");
|
2019-06-19 14:40:52 +00:00
|
|
|
const CheckerPlugin = require("fork-ts-checker-webpack-plugin");
|
|
|
|
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
|
|
|
|
|
2019-08-09 11:14:35 +00:00
|
|
|
module.exports = ({ config }) => {
|
2019-06-19 14:40:52 +00:00
|
|
|
config.module.rules.push({
|
|
|
|
exclude: /node_modules/,
|
2022-05-05 07:54:28 +00:00
|
|
|
loader: "esbuild-loader",
|
2019-06-19 14:40:52 +00:00
|
|
|
options: {
|
2022-05-05 07:54:28 +00:00
|
|
|
loader: "tsx",
|
2022-06-21 09:36:55 +00:00
|
|
|
target: "es2015",
|
2019-12-02 15:26:31 +00:00
|
|
|
},
|
2022-06-21 09:36:55 +00:00
|
|
|
test: /\.(jsx?|tsx?)$/,
|
2019-06-19 14:40:52 +00:00
|
|
|
});
|
|
|
|
config.optimization.removeAvailableModules = false;
|
|
|
|
config.optimization.removeEmptyChunks = false;
|
|
|
|
config.optimization.splitChunks = false;
|
|
|
|
config.resolve.extensions.push(".ts", ".tsx");
|
|
|
|
config.resolve.plugins = [
|
|
|
|
new TsconfigPathsPlugin({
|
2022-06-21 09:36:55 +00:00
|
|
|
configFile: "./tsconfig.json",
|
|
|
|
}),
|
2019-06-19 14:40:52 +00:00
|
|
|
];
|
2021-07-21 08:59:52 +00:00
|
|
|
// Resolve macaw ui's peer dependencies to our own node_modules
|
|
|
|
// to make it work with npm link
|
|
|
|
config.resolve.alias = {
|
|
|
|
react: path.resolve("./node_modules/react"),
|
|
|
|
"react-dom": path.resolve("./node_modules/react-dom"),
|
|
|
|
"@material-ui/core": path.resolve("./node_modules/@material-ui/core"),
|
|
|
|
"@material-ui/icons": path.resolve("./node_modules/@material-ui/icons"),
|
2022-06-21 09:36:55 +00:00
|
|
|
"@material-ui/styles": path.resolve("./node_modules/@material-ui/styles"),
|
2021-07-21 08:59:52 +00:00
|
|
|
};
|
2019-12-02 15:26:31 +00:00
|
|
|
config.plugins.push(
|
|
|
|
new CheckerPlugin({
|
2022-06-21 09:36:55 +00:00
|
|
|
eslint: true,
|
|
|
|
}),
|
2019-12-02 15:26:31 +00:00
|
|
|
);
|
2019-06-19 14:40:52 +00:00
|
|
|
return config;
|
|
|
|
};
|