From 8d0f84620819e1966311e514f87068d2445d8bae Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 23 Aug 2022 11:18:02 +0200 Subject: [PATCH] chore: updating resolve plugins Signed-off-by: blam --- packages/cli/src/lib/bundler/config.ts | 35 +++++++++++--------------- storybook/.storybook/main.js | 1 + 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/lib/bundler/config.ts b/packages/cli/src/lib/bundler/config.ts index 882926d051..0d4649fa3f 100644 --- a/packages/cli/src/lib/bundler/config.ts +++ b/packages/cli/src/lib/bundler/config.ts @@ -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, diff --git a/storybook/.storybook/main.js b/storybook/.storybook/main.js index 95d4c80035..81466108f6 100644 --- a/storybook/.storybook/main.js +++ b/storybook/.storybook/main.js @@ -88,6 +88,7 @@ module.exports = Object.assign(({ args }) => { loader: require.resolve('swc-loader'), options: { jsc: { + target: 'es2019', parser: { syntax: 'ecmascript', jsx: true,