-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeScript] Path aliases with Expo Web #4606
Comments
This seems unrelated to TypeScript if I understand it correctly. You need to tell TS about the aliases so that the type checks will pass, but the bundlers use separate configurations. On web you will need to configure webpack. How is this working with Metro? |
Agree with @ide, I'm not sure how this works in the first place.
// webpack.config.js
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
// Expo CLI will await this method so you can optionally return a promise.
module.exports = async function(env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
config.resolve.alias['moduleA'] = 'moduleB';
// Finally return the new config for the CLI to use.
return config;
}; Please refer to the Webpack guide in the expo docs for more info: https://docs.expo.io/versions/v33.0.0/guides/customizing-webpack/ |
There is one more thing I had to do to get this working. I had to configure my Example code:
|
Sorry guys for disinformation
Setting the code above made the things working :) |
This has been fixed upstream for a bit now, verified with:
|
🐛 Bug Report
Using TypeScript paths works fine on mobile, but not with Expo web.
Environment
Web
Steps to Reproduce
Add
paths
andbaseUrl
to yourtsconfig.json
file.For example:
And then import a file using the
@src/
syntax syntax. eg:Expected Behavior
The project should run on web. (It does work on iOS simulator).
Actual Behavior
The project fails to compile, with an error similar to this:
Error:
Reproducible Demo
The text was updated successfully, but these errors were encountered: