From bcb8db621c108e2a05531e7648ecfe2c0f64b7e4 Mon Sep 17 00:00:00 2001 From: Jesse Yang Date: Wed, 6 Jan 2021 23:36:24 -0800 Subject: [PATCH] build: improve webpack configs for npm link (#12313) --- superset-frontend/tsconfig.json | 8 ++++++++ superset-frontend/webpack.config.js | 1 + 2 files changed, 9 insertions(+) diff --git a/superset-frontend/tsconfig.json b/superset-frontend/tsconfig.json index b158eebfb..af1fc299e 100644 --- a/superset-frontend/tsconfig.json +++ b/superset-frontend/tsconfig.json @@ -17,6 +17,14 @@ "outDir": "./dist", "pretty": true, "paths": { + "@superset-ui/core": [ + "./node_modules/@superset-ui/core/src", + "./node_modules/@superset-ui/core" + ], + "@superset-ui/chart-controls": [ + "./node_modules/@superset-ui/chart-controls/src", + "./node_modules/@superset-ui/chart-controls" + ], // for supressing errors caused by incompatible @types/react when `npm link` // Ref: https://github.com/Microsoft/typescript/issues/6496#issuecomment-384786222 "*": ["./node_modules/@types/*", "*"] diff --git a/superset-frontend/webpack.config.js b/superset-frontend/webpack.config.js index 209c627c6..a7b66161b 100644 --- a/superset-frontend/webpack.config.js +++ b/superset-frontend/webpack.config.js @@ -459,6 +459,7 @@ if (isDevMode) { // only allow exact match so imports like `@superset-ui/plugin-name/lib` // and `@superset-ui/plugin-name/esm` can still work. config.resolve.alias[`${pkg}$`] = `${pkg}/src`; + delete config.resolve.alias[pkg]; hasSymlink = true; } });