This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
Support for TypeScripts 'paths' option #203
Open
Description
I'm trying to implement alias for importing modules from root of my project. According to typescripts docs it can be done by adding following configuration to 'tsconfig.json' file
"baseUrl": "./",
"paths": {
"~/*": ["./src/*"]
I get no Typescript compile error, but error from webpack i.e.
Failed to compile.
./src/App.tsx
Module not found: Can't resolve '~/components/forms' in '/Users/mike/dev/js/react-ts/src'
My env:
macOS 12.12.3
node v. 6.10
create-react-app 1.4.3
react-scripts-ts 2.8.0
It seems to be known issue and was resolved in awesome-typescript-loader using plugin https://github.com/dividab/tsconfig-paths-webpack-plugin.
For now I change my typescript config to
"paths": {
"src/*": ["./src/*"]
},
and added .env file with
NODE_PATH=.
Seems that it fixed global imports inside my project but it not very flexible.
Metadata
Metadata
Assignees
Labels
No labels