From 7a434d469af3faa2a2bea2a45723b131fd09d771 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Tue, 26 Nov 2019 15:03:08 -0500 Subject: [PATCH] fix(web): resolve issue where different core-js versions exist in the same workspace Closes #2086 --- e2e/utils.ts | 7 +------ packages/web/src/utils/config.ts | 5 ++++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/e2e/utils.ts b/e2e/utils.ts index 0aee9d15cf96b..5d356c3894d9a 100644 --- a/e2e/utils.ts +++ b/e2e/utils.ts @@ -214,12 +214,7 @@ export function copyMissingPackages(): void { '@testing-library', // For testing webpack config with babel-loader - '@babel/core', - '@babel/preset-env', - '@babel/preset-react', - '@babel/preset-typescript', - '@babel/plugin-proposal-class-properties', - '@babel/plugin-proposal-decorators', + '@babel', 'babel-loader', 'babel-plugin-macros', 'eslint-plugin-import', diff --git a/packages/web/src/utils/config.ts b/packages/web/src/utils/config.ts index 71a7a92f5b4ec..3a35cbb68a4f5 100644 --- a/packages/web/src/utils/config.ts +++ b/packages/web/src/utils/config.ts @@ -1,6 +1,6 @@ import * as webpack from 'webpack'; import { Configuration, ProgressPlugin, Stats } from 'webpack'; -import { dirname } from 'path'; +import { dirname, resolve } from 'path'; import { LicenseWebpackPlugin } from 'license-webpack-plugin'; import * as CopyWebpackPlugin from 'copy-webpack-plugin'; import * as TerserWebpackPlugin from 'terser-webpack-plugin'; @@ -63,6 +63,9 @@ export function getBaseWebpackPartial( mainFields }) ], + // Search closest node_modules first, and then fallback to to default node module resolution scheme. + // This ensures we are pulling the correct versions of dependencies, such as `core-js`. + modules: [resolve(__dirname, '..', '..', 'node_modules'), 'node_modules'], mainFields }, performance: {