build: improve webpack configs for npm link (#12313)

This commit is contained in:
Jesse Yang 2021-01-06 23:36:24 -08:00 committed by GitHub
parent 8214237638
commit bcb8db621c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -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/*", "*"]

View File

@ -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;
}
});