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

Packages are not being detected when concatenateModules is set to true #10

Open
kubk opened this issue Apr 18, 2022 · 6 comments
Open
Assignees

Comments

@kubk
Copy link

kubk commented Apr 18, 2022

Hi, I am a Mobx team member and I'd like to see if GradeJS detects Mobx. This library is listed among the indexed packages.

I've created a brand new create-react-app project and added Mobx there.

As you can see it doesn't detect mobx and mobx-react, but it does detect react, react-dom

To get the build locally clone the repo and run npm run build in the project folder.

I've chosen create-react-app because it uses Webpack internally and it has 3.1+ millions installations per week. So chances that the webpack configuration is screwed up are pretty low. If you want to see the configuration you can run npm run eject script in the project folder.

Since GradeJS currently supports only Webpack 3-5, I checked that the current Webpack version matches this requirement by running npm ls webpack. It shows version 5.72 everywhere:

Screen Shot 2022-04-18 at 16 11 55

The Mobx itself is built using Rollup. Also it is a monorepo in case it matters.

Let me know if you need more details.

@spalt08
Copy link
Collaborator

spalt08 commented Apr 20, 2022

Hi Egor, thanks for the contribution.
We are currently busy with some pre-release improvements and will run synthetic tests on different webpack presets with mobx and mobx-react earlier next week and get back to you with more information.

@spalt08
Copy link
Collaborator

spalt08 commented May 30, 2022

Hi Egor,
I'm sorry for the delay, we have been working on some product features instead of accuracy recently.
We haven't forgot about the issue and will investigate it in the near future

@kubk
Copy link
Author

kubk commented May 30, 2022

@spalt08 Sure, take your time. Thanks for keeping me posted 👍

@ctizen
Copy link
Contributor

ctizen commented Jul 6, 2022

Hi Egor,
Sorry for the delay.
I took a look at the bundle and found that mobx esm module code was inlined into application code along with some other libraries inside the IIFE generated by webpack, see the illustration:

image

I tried to set optimization.concatenateModules to false in the webpack config explicitly, and it helped:

image

Unfortunately, we don't support matching inlined modules at the moment, but we have this case in our research roadmap, as it is default behavior of any application built with create-react-app.

@kubk
Copy link
Author

kubk commented Jul 7, 2022

@ctizen Thanks for digging into this 👍 CRA is quite popular, it'd be nice to have a solution for the concatenateModules option. Should I rename the issue title to something like "Packages are not being detected when concatenateModules is set to true"?

@ctizen ctizen changed the title Mobx is not detected in default CRA setup Packages are not being detected when concatenateModules is set to true Jul 13, 2022
@ctizen
Copy link
Contributor

ctizen commented Jul 13, 2022

@kubk No problem, renamed it. Thanks:) We'll reach out when we have the solution.

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

No branches or pull requests

4 participants