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

Remove Rollup and just use Webpack #9

Closed
d3dc opened this issue Mar 7, 2019 · 5 comments
Closed

Remove Rollup and just use Webpack #9

d3dc opened this issue Mar 7, 2019 · 5 comments

Comments

@d3dc
Copy link
Owner

d3dc commented Mar 7, 2019

Rollup is an additional dependency, that has its own set of problems and plugins.

I didn't use Webpack initially, because I just went with what works.

To use Webpack, we have to remove the HTML plugin, and change the inputs/outputs. This doesn't seem like that much work using the craco utils?

Update: and then the bundled code needs to be built in a format that allows the most flexible use - it seems like we would want ESM bundles to let motherships use treeshaking across the fleet

@d3dc
Copy link
Owner Author

d3dc commented Mar 10, 2019

It looks like ES modules may not be possible until Webpack 5

Is tree-shaking a must-have?

  • yes - rollup can bundle CommonJS inside ESM
  • no - Its much simpler to output a production library build from Webpack - which has an IIFE until v5

@d3dc
Copy link
Owner Author

d3dc commented Mar 12, 2019

Why not just transpile with babel and do nothing else?

@d3dc
Copy link
Owner Author

d3dc commented Mar 12, 2019

For now using rollup as a "task runner" lets us emit ESM.

If we just run babel, aliases won't be resolved in stylesheets. Relative paths in stylesheets may also break. I used rollup-plugin-rebase to address this in a hacky way.

@d3dc
Copy link
Owner Author

d3dc commented Mar 12, 2019

This leaves us with the question:

  • Specializing for ESM means we are targeting an environment that gets bundled.
  • Do we need to create a UMD build along-side the module?

@d3dc
Copy link
Owner Author

d3dc commented Mar 14, 2019

For now, rollup is used to create an ESM and a UMD bundle both with peer dependencies, instead of tackling questions with CommonJS etc.

@d3dc d3dc closed this as completed Mar 14, 2019
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

1 participant