Skip to content
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

Doesn't work in Production #403

Open
rishisingh-dev opened this issue Jul 21, 2020 · 19 comments
Open

Doesn't work in Production #403

rishisingh-dev opened this issue Jul 21, 2020 · 19 comments

Comments

@rishisingh-dev
Copy link

rishisingh-dev commented Jul 21, 2020

I am using this package in my ReactNative project.
It works well in simulator but when I publish app to app store, it doesn't work.
(To be more exact, only assets folder doesn't work. Other folders work.)

jsconfig.json

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "paths": {
      "assets/*": ["src/assets/*"],
      "components/*": ["src/components/*"],
      "navigators/*": ["src/navigators/*"],
      "screens/*": ["src/screens/*"],
      "core/*": ["src/core/*"],
      "questions/*": ["src/questions/*"],
      "redux/*": ["src/redux/*"]
    }
  }
}

environment

"babel-plugin-module-resolver": "^4.0.0",
"react": "16.13.1",
"react-native": "0.63.0",

npm - 4.2.0
node - 10.21.0
@afestein
Copy link

afestein commented Jul 22, 2020

Similar issues here - I get a bundle error when attempting distribution: error Unable to resolve module components/root from index.js: components/root could not be found within the project.

Possibly related:
facebook/react-native#29351
https://stackoverflow.com/questions/62806319/main-jsbundle-does-not-exist-this-must-be-a-bug-with-main-jsbundle-issue-afte/62914788#62914788

@cogell
Copy link

cogell commented Jul 30, 2020

This answer in the same stackoverflow thread worked for me: https://stackoverflow.com/a/62872851/1873778

babel.config.js -> .babelrc.js

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Aug 6, 2020

Have same issue in Production.... Guys, could you please check, we are really blocked. It happens in react-native@0.63,
react-native@0.62 works fine. Looks like they have changed some mechanism for babel

@afestein
Copy link

afestein commented Aug 6, 2020

For me, the solution was a combination of the following suggestions:

https://stackoverflow.com/a/62914788
facebook/react-native#29351 (comment)

@oleksandr-dziuban
Copy link

@afestein It doesn't work for me... Did you try production builds for iOS successfully?

@oleksandr-dziuban
Copy link

@tleunen Could you please help with this issue? It is related to react-native@0.63.0+ versions.... and this is really big blocker for all production projects with this babel plugin.. Thanks a lot

@tleunen
Copy link
Owner

tleunen commented Aug 12, 2020

@oleksandr-dziuban I've never used this plugin with React Native so I unfortunately cannot help.
So hopefully some other users and RN devs can help with this issue, and if there's something to be fixed, feel free to send a PR.

@Yuriy1988

This comment has been minimized.

@oleksandr-dziuban
Copy link

@oleksandr-dziuban I've never used this plugin with React Native so I unfortunately cannot help.
So hopefully some other users and RN devs can help with this issue, and if there's something to be fixed, feel free to send a PR.

Issue not in this library, but in react-native code.. Possibly this PR will solve the issue:
facebook/react-native#29477

@Fedir-S
Copy link

Fedir-S commented Aug 12, 2020

faced the same issue after updating RN to 0.63.0 :(

@oleksandr-dziuban
Copy link

Additionally raised this issue for react native repo:
facebook/react-native#29636

It is critical issue for projects with this babel plugin

@oleksandr-dziuban
Copy link

Yes, I can confirm, this PR fixes the issue! facebook/react-native#29477

I have assembled release iOS build locally with this change and it works!

@sparebytes
Copy link

sparebytes commented Aug 28, 2020

Maybe this is an unrelated issue, but it appears that this plugin will pick the first key that starts with the alias. eg

// babel.config.js
{
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["."],
        "alias": {
          "a/b": "./src/a/b/index",
          "a/b/c": "./src/a/b/c/index"
        }
      }
    ]
  ]
}

// src/app.js
import x from "a/b/c"; // resolves to "./a/b/index/c"

@oleksandr-dziuban
Copy link

oleksandr-dziuban commented Aug 31, 2020

Maybe this is an unrelated issue, but it appears that this plugin will pick the first key that starts with the alias. eg

// babel.config.js
{
  "plugins": [
    [
      "module-resolver",
      {
        "root": ["."],
        "alias": {
          "a/b": "./src/a/b/index",
          "a/b/c": "./src/a/b/c/index"
        }
      }
    ]
  ]
}

// src/app.js
import x from "a/b/c"; // resolves to "./a/b/index/c"

No, it doesn't work. I use alias and release builds failed for iOS. The reason in react-native 0.63.2 change for react-native-xcode.sh file.

@abumalick
Copy link

Thank you very much for pointing to the PR that fixes the bug @oleksandr-dziuban

I used https://www.npmjs.com/package/patch-package to patch react-native with the PR changes after installing packages. It worked for me.

@oleksandr-dziuban
Copy link

Thank you very much for pointing to the PR that fixes the bug @oleksandr-dziuban

I used https://www.npmjs.com/package/patch-package to patch react-native with the PR changes after installing packages. It worked for me.

Hi, yes, I'm using this workaround too, but we need this PR to be merged anyway as it is critical iOS issue on react-native platform

@tbakerx
Copy link

tbakerx commented Nov 3, 2021

I'm still seeing this issue in a 0.66 react native build. It all works correctly in dev on android and ios, as well as a production android build. But when I try to bundle for iOS in production it can't resolve any of the aliases.

Is anyone else still seeing this? I've scoured and tested everyone's previous solutions outlined through the many linked issues in this thread to no avail

@314new
Copy link

314new commented Nov 14, 2021

I'm still seeing this issue in a 0.66 react native build. It all works correctly in dev on android and ios, as well as a production android build. But when I try to bundle for iOS in production it can't resolve any of the aliases.

Is anyone else still seeing this? I've scoured and tested everyone's previous solutions outlined through the many linked issues in this thread to no avail

I also have the problem, do you resolve it?

@raykle
Copy link

raykle commented Nov 19, 2021

#332 (comment)

@tbakerx @314new Have you tried this config? It works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests