wmr icon indicating copy to clipboard operation
wmr copied to clipboard

Rewrite node module handling (npm plugin)

Open marvinhagemeister opened this issue 4 years ago • 2 comments

This PR is a rewrite of the way we handle node modules and fetch them from the npm registry.

  • Add support for browser field in package.json
  • Unify development and production handling into a single plugin. Previously, we used a middleware during development and a rollup plugin for production
  • 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 --autoInstall and 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_modules folder 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 setCwd hack 🎉
  • 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 etag caching
  • [x] ~Bring back brotli compression background upgrades~ - already present

Fixes #299, fixes #784, fixes #285, fixes #135, fixes #109, fixes #151, fixes #167

marvinhagemeister avatar Sep 19 '21 19:09 marvinhagemeister

🦋 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

changeset-bot[bot] avatar Sep 19 '21 19:09 changeset-bot[bot]

Hey!

Nice PR, I need this change in order to work with wmr... maybe I can help somehow to make this PR go through?

bakeiro avatar Jun 01 '22 08:06 bakeiro