-
Notifications
You must be signed in to change notification settings - Fork 210
Path Aliasing? #16
Comments
I've been struggling with this as well. Actual behavior
Error details
Configurationtsconfig.json{
"include": ["./src/"],
"compilerOptions": {
"target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"allowJs": true, /* Allow javascript files to be compiled. */
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
"sourceMap": true, /* Generates corresponding '.map' file. */
"outDir": "./built", /* Redirect output structure to the directory. */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": false, /* Raise error on expressions and declarations with an implied 'any' type. */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": "./src", /* Base directory to resolve non-absolute module names. */
"skipLibCheck": true
}
} .babelrc{
"presets": [
"react-native"
]
} Example files
|
ActionSo I tried to put package.json files into the Move package.json files from
|
Any updates on this? I'm trying to use TS with an ejected app from CRNA, but it won't resolve my path aliases |
For other folks, I did find this helpful for absolute paths: I too struggled with the alias pathing issue as mentioned above, but at least with this I could do: |
any updates? |
I am solve this problem. Just add to metro.config.js attribute package.json.
metro.config.js. Add
tsconfig.json
babel.config.js
App.tsx
|
@vacoo solution works for me, but just a friendly tip: you may need to re-install the app to make it work. |
Thanks @vacoo, worked for me. sharing my config as it includes also the ts files and special case using Alias for ONE ts file: tsconfig.json path property
babel.config.js:
P.S - I did this with default ts template provided with react-native CLI - not this Microsft template |
the generated code doesn't fully resolve paths specified in the
tsconfig.json
The text was updated successfully, but these errors were encountered: