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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.9.7] UMD incorrectly tree shaking module #1740
Comments
I am also seeing modules be omitted that should have been included, when using TypeScript |
Had a little play around with it today, and I don't think the issue is to do with export from at all. It seems to be because of a UMD module. I'll update the possible solution. The export from fix I mentioned previously may have just been deceptive. @sqs Your issue could be the same as mine, could you check it out if you can? |
Yes, mine is a different issue then. Thanks. |
Appears to be fixed by #2993. |
馃悰 bug report
When using the experimental scope hoisting argument on build, I'm getting the following error:
Uncaught TypeError: Object prototype may only be an Object or null: undefined
The error does not appear if I build without experimental scope hoisting.
馃帥 Configuration (.babelrc, package.json, cli command)
Tsconfig.json:
馃 Expected Behavior
It should build correctly.
馃槸 Current Behavior
This function was throwing the error:
The function seems to be generated automatically by the typescript compiler, and is simulating single class inheritance.
Here, the function is called with an undefined value (e/Qm), hence the error. Following the stack trace, it brings me back to a file called httpLink.js in the apollo-link-http library.
httpLink.js before Parcel build:
In Parcel bundle:
ApolloLink doesn't seem to appear in the bundle at all. There is just an undeclared variable in its place.
馃拋 Possible Solution
The problem seems to stem from the fact that importing just the ApolloProvider from react-apollo is tree shaking apollo-client out of the bundle.
Since ApolloProvider does not use the apolloClient import here, it gets taken out. But, apollo-client is still required by the app:
The error seems to go away if I remove the apolloClient import in the UMD module, or if I import the ApolloProvider file directly.
馃敠 Context
Couldn't build an application using Scope Hoisting and Apollo due to the problem.
馃捇 Code Sample
https://github.com/Icestorm05/react-apollo-test
馃實 Your Environment
The text was updated successfully, but these errors were encountered: