8000 Switch from Gulp + Webpack to Rollup for bundling by hughrawlinson · Pull Request #824 · meyda/meyda · GitHub
[go: up one dir, main page]

Skip to content

Switch from Gulp + Webpack to Rollup for bundling - #824

Merged
hughrawlinson merged 9 commits into
masterfrom
try-rollupjs
May 30, 2021
Merged

hughrawlinson merged 9 commits into
masterfrom
try-rollupjs

Conversation

@hughrawlinson
@hughrawlinson hughrawlinson commented May 25, 2021 •
Copy link
Copy Markdown
Member

I suspect that rollup is a way for us to remove both webpack and gulp. It has a nice API, I find that it's easier to use than the combination of gulp and webpack, so I think it will simplify our build a little bit. It supports UMD and cjs exports, and plugins provide node packages we use, resolve node internals, minify (using the same minifier we use in webpack), and babel transpilation. Source maps are included. I think this is all we need. Perhaps we should also bundle babel transpiled es6 modules, which would be an additional win. Currently our es6 entrypoint is just the source, which won't work for environments that for example support es6 imports but don't support the object spread operator or other newer ES features.

This isn't done though - I need to verify that what rollup outputs is close enough to what we've been shipping for all these years.

  • Preserve file structure in multi-entry-point build output.

@hughrawlinson
hughrawlinson force-pushed the try-rollupjs branch 3 times, most recently from a20ea71 to a96b91b Compare May 28, 2021 11:35
@hughrawlinson
hughrawlinson marked this pull request as ready for review May 28, 2021 13:28
@hughrawlinson
Copy link
Copy Markdown
Member Author

This migration is ready to be reviewed 🎆

The export tests confirm that each entrypoint is exporting the correct things in the correct way, and I've tested it with the docs demo, and the CLI and it seems to work fine.

The contents of this branch are published to meyda@beta (meyda@5.1.8-beta.1 at the moment), so I would appreciate if others could test it out and see if I've broken their projects!

@hughrawlinson hughrawlinson changed the title Try Rollup Switch from Gulp + Webpack to Rollup for bundling May 28, 2021
@hughrawlinson
Copy link
Copy Markdown
Member Author

issue: gotta also upgrade the docs bundling to rollup!

@hughrawlinson
Copy link
Copy Markdown
Member Author

Insane issue: when I bundle the docs demo implementation with rollup, and try to load the demo, my firefox browser tab crashes in Linux. No idea what might be causing this.

@hughrawlinson
Copy link
Copy Markdown
Member Author

The bundle works fine in Firefox on Windows, so I'm good with assuming that there was something interesting up with my Linux machine, and with that this PR is good from my perspective. Please weigh in if you have thoughts!

@hughrawlinson
Copy link
Copy Markdown
Member Author

Should check the Rollup support for AudioWorklet before committing to this.

@hughrawlinson
Copy link
Copy Markdown
Member Author

I've looked into Rollup support for AudioWorklet, and it's at about the same stage Webpack was at when I last looked into it. But, this time I was able to hack the rollup-plugin-web-worker-loader package to actually do a real bundle with a working AudioWorklet use that exports a commonjs bundle, so I'm confident that when we need to use AudioWorklet we'll be ok (barring the fact that the AudioWorklet constructor is asynchronous so we might have to handle that in a fun way, but we'd have to do that anyway).

Yes, this is me committing to writing the rollup plugin for AudioWorklet if it comes to it!

The demo is available here - and it links to the patch I applied to rollup-plugin-web-worker-loader.

@hughrawlinson
Copy link
Copy Markdown
Member Author

@2xAA has checked that this works with ModV and it does, so I'm going to go ahead with it!

@hughrawlinson
hughrawlinson merged commit 1b40a87 into master May 30, 2021
@hughrawlinson
hughrawlinson deleted the try-rollupjs branch May 30, 2021 12:15
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 5.1.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Development

Successfully merging this pull request may close these issues.

1 participant

0