chore: updating resolve plugins

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-08-23 11:18:02 +02:00
parent 0cbd697279
commit 8d0f846208
2 changed files with 15 additions and 21 deletions
+14 -21
View File
@@ -135,10 +135,6 @@ export async function createConfig(
}),
);
const resolvePlugins: webpack.ResolvePluginInstance[] = [
new LinkedPackageResolvePlugin(paths.rootNodeModules, externalPkgs),
];
// These files are required by the transpiled code when using React Refresh.
// They need to be excluded to the module scope plugin which ensures that files
// that exist in the package are required.
@@ -150,13 +146,6 @@ export async function createConfig(
require.resolve('react-refresh'),
];
resolvePlugins.push(
new ModuleScopePlugin(
[paths.targetSrc, paths.targetDev],
[paths.targetPackageJson, ...reactRefreshFiles],
),
);
return {
mode: isDev ? 'development' : 'production',
profile: false,
@@ -188,7 +177,13 @@ export async function createConfig(
http: false,
util: require.resolve('util/'),
},
plugins: resolvePlugins,
plugins: [
new LinkedPackageResolvePlugin(paths.rootNodeModules, externalPkgs),
new ModuleScopePlugin(
[paths.targetSrc, paths.targetDev],
[paths.targetPackageJson, ...reactRefreshFiles],
),
],
},
module: {
rules: loaders,
@@ -236,14 +231,6 @@ export async function createBackendConfig(
runScriptNodeArgs.push('--inspect-brk');
}
const resolvePlugins: webpack.ResolvePluginInstance[] = [
new LinkedPackageResolvePlugin(paths.rootNodeModules, externalPkgs),
new ModuleScopePlugin(
[paths.targetSrc, paths.targetDev],
[paths.targetPackageJson],
),
];
return {
mode: isDev ? 'development' : 'production',
profile: false,
@@ -283,7 +270,13 @@ export async function createBackendConfig(
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json'],
mainFields: ['main'],
modules: [paths.rootNodeModules, ...moduleDirs],
plugins: resolvePlugins,
plugins: [
new LinkedPackageResolvePlugin(paths.rootNodeModules, externalPkgs),
new ModuleScopePlugin(
[paths.targetSrc, paths.targetDev],
[paths.targetPackageJson],
),
],
},
module: {
rules: loaders,
+1
View File
@@ -88,6 +88,7 @@ module.exports = Object.assign(({ args }) => {
loader: require.resolve('swc-loader'),
options: {
jsc: {
target: 'es2019',
parser: {
syntax: 'ecmascript',
jsx: true,