forked from ZachJW34/nx-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tsconfig paths support for importing vue libraries into nuxt apps
- Loading branch information
1 parent
6e7bf40
commit 8c37b2c
Showing
4 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { getSystemPath, join, Path } from '@angular-devkit/core'; | ||
import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export function modifyTypescriptAliases(config: any, projectRoot: Path): void { | ||
['~~', '@@', '~', '@', 'assets', 'static'].forEach( | ||
(key) => delete config.resolve.alias[key] | ||
); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
const options: any = { | ||
configFile: getSystemPath(join(projectRoot, 'tsconfig.json')), | ||
extensions: [...config.resolve.extensions, '.ts', '.tsx'], | ||
}; | ||
|
||
if (config.resolve.mainFields) { | ||
options.mainFields = config.resolve.mainFields; | ||
} | ||
|
||
config.resolve.plugins = [ | ||
...(config.resolve.plugins || []), | ||
new TsconfigPathsPlugin(options), | ||
]; | ||
} |