wmr
wmr copied to clipboard
Rewrite node module handling (npm plugin)
This PR is a rewrite of the way we handle node modules and fetch them from the npm registry.
- Add support for
browserfield inpackage.json - Unify
developmentandproductionhandling into a single plugin. Previously, we used a middleware duringdevelopmentand a rollup plugin forproduction - Prebundles dependencies to greatly reduce the number of requests. Previously, we'd fetch each file of an npm package individually.
- Improve CommonJS handling by attempting to convert it to ESM. Note that CommonJS in general has severe limitations in an ESM world and can't be served correctly.
- Auto installing of npm packages is moved to a CLI flag
--autoInstalland is disabled by default. The auto install feature is contained in a separate plugin. - Support for monorepo setups. We'll now follow the node resolution algorithm and traverse upwards until we find a
node_modulesfolder with the package we're looking for. - npm registry is not a global anymore and can be set from cli via
--registry. - Get's rid of the
setCwdhack 🎉 - We didn't have any tests regarding the npm plugin, so this PR adds them. They make up the lion share of the changes.
Todos:
- [x] Support non-js files from npm packages
- [x] Bring back package versioning (only for auto install)
- [x] Fully remove previous npm plugin
- [x] Bring back
etagcaching - [x] ~Bring back brotli compression background upgrades~ - already present
Fixes #299, fixes #784, fixes #285, fixes #135, fixes #109, fixes #151, fixes #167
🦋 Changeset detected
Latest commit: 30439672574d21b0287987c8cc47bedc92d5972e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| wmr | Major |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
Hey!
Nice PR, I need this change in order to work with wmr... maybe I can help somehow to make this PR go through?