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

[BUG] code splitting error on build #19

Closed
adnanfajlur opened this issue Jul 1, 2020 · 3 comments
Closed

[BUG] code splitting error on build #19

adnanfajlur opened this issue Jul 1, 2020 · 3 comments

Comments

@adnanfajlur
Copy link

adnanfajlur commented Jul 1, 2020

got incorrect build with ...args on component

image

success without ...args

image

thanks

@HarveyD
Copy link
Owner

HarveyD commented Jul 1, 2020

Okay so after a bit of experimenting, I've found this happens because of the @rollup/plugin-node-resolve plugin.

When Rollup needs to bundle packages from node_modules, this plugin will mess up the directory structure of our output. In this case, it's bundling tslib (you can see this under node_modules in build).

To solve this, you can:

  • Add tslib to the external field in rollup.config.js,
  • Add it to peerDependencies in package.json (This will prevent tslib from being bundled because of the peerDepsExternal plugin.)
  • Remove @rollup/plugin-node-resolve

I've updated the branch without the @rollup/plugin-node-resolve plugin which has fixed the issue. The downside of removing this plugin is that our bundle won't be able to benefit from Node Resolution Algorithm

@adnanfajlur
Copy link
Author

adnanfajlur commented Jul 2, 2020

it works dude, thanks 😁👌

@mnlbox
Copy link

mnlbox commented Jul 23, 2020

@HarveyD Can you explain this?

The downside of removing this plugin is that our bundle won't be able to benefit from Node Resolution Algorithm.

What we are exactly lost in after remove resolve() from plugins for code splitting?

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

3 participants