Questions tagged [babel-plugin-module-resolver]
14 questions
14
votes
8 answers
React native Typescript path alias unable to resolve module
so basically, I created my React Native with Typescript using the commandline in RN homepage:
npx react-native init MyApp --template react-native-template-typescript
After that, I ran the project and it was built successfully.
However, when I added…

jackieTruong123
- 251
- 1
- 3
- 7
4
votes
0 answers
Configure custom "root" directory with "babel-plugin-module-resolver"?
Here is my project structure:
cloudRun
distApp // TRANSPILED APP FILES FROM ./src
distService // TRANSPILED BACKEND FILES FROM ./cloudRun/src
src // SOURCE FILES FOR THE BACKEND CODE
index.js // INDEX.JS…

cbdeveloper
- 27,898
- 37
- 155
- 336
3
votes
1 answer
Babel module resolver doesn't work as expected (node + typescript)
In my node project, I use babel-plugin-module-resolver to have relative paths.
tsconfig.json
{
"compilerOptions": {
"outDir": "build",
"target": "es5",
"module": "commonjs",
"strict":…

Shashika Virajh
- 8,497
- 17
- 59
- 103
1
vote
0 answers
Not able to absolute import in React Native project using babel-plugin-module-resolver
The file structure of my project is:
|--node_modules
|--src
|--App.js
|--Splash.js
I want to import Splash.js in App.js using absolute import.
So, I added babel-plugin-module-resolver and set up a babel.config.js with the following contents…

ath
- 11
- 2
1
vote
0 answers
Why does cjs file extension on babel.config break module-resolver?
I have created a minimal reproducable example with a detailed README here.
In my expo app, I was having trouble using the babel module-resolver to use path aliases. My Metro bundling would fail when I used path aliases.
I learned that when I changed…

aDevCalledAlex
- 19
- 2
1
vote
1 answer
Babel - how to set aliases to outside of the root directory?
I have a monorepo:
domain/
entities/
account.ts
...
mobile/
src/
app.ts
node_modules/
package.json
babel.config.js
I want to set an alias so that app.ts can simply call:
import { Account } from…

kibe
- 90
- 1
- 8
- 26
0
votes
1 answer
React native babel config " Cannot find module 'babel-plugin-module-resolver' " error
I tried to define the path with babel. I am not sure if is it because of it or not but I got this error. But an error showed up after adding packages. I could understand in fact what is the reason so I don't have more explanation and detail. Sorry…

the Great A
- 25
- 4
0
votes
1 answer
React Native - babel.config.js alias not seeing files outside the current working directory
So, my project is monorepo. There are folders for web application, mobile application, etc. And there is also a common folder, where gathered all the reusable components and utils.
├── app // mobile app
│ ├── node_modules
│ ├── src
│…

Limbo
- 2,123
- 21
- 41
0
votes
0 answers
babel-plugin-module-resolver intellisense with vs code
babel-plugin-module-resolver is working fine but IntelliSense is not working in vs code, please check my integrations and let me know what's going wrong here. with all these code integrations my imports are resolved but without IntelliSense, I have…

AliRehman7141
- 873
- 3
- 12
- 33
0
votes
0 answers
"Cannot find module 'babel-plugin-module-resolver'" on a CI/CD pipeline
I set up a pipeline on a CI/CD (Azure Devops) to build my react native app, specifically for android.
Even though it builds correctly on my local mac (Mac OS 12.1), and assembles to a valid APK correctly, the same build step throws an error in the…

Hans Araya
- 345
- 2
- 15
0
votes
1 answer
babel-plugin-module-resolver not working on .jsx files
I am working on a Typescript + SSR + ReactJs application. I am struggling to making this project works. The project actually works if I use relative paths, however I would like to use alias, and here is when the problems come. I also was able to…

Valentin Reviglio
- 33
- 3
- 5
0
votes
1 answer
How to shim a dependency in babel.config.js in react-native?
I've got a dependency I'd like to shim on my react-native project. I currently have the following code on my babel.config.js file:
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
…

Passaro
- 93
- 1
- 8
0
votes
1 answer
Module resolving between react and react native projects?
We have two projects that share a API wrapper library (that we created) that makes use of the pusher-js library for websocket communication.
The API wrapper was originally built for the web version project built on NextJS, but now we wish to include…

joshuaaron
- 810
- 1
- 15
- 27
0
votes
1 answer
Error app.default.object is not a function
I am new to react-native and I'm trying to help on a project. I started by refactoring the code to have a better file structure. I implemented the barrels and added the path aliases (module resolver).
Everything works fine in vscode but when I run…

Edwin ZAP
- 419
- 1
- 4
- 16