0.0.3 • Published 1 year ago

@phantom-labs/parcel-optimizer-suspend-amd v0.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

parcel-optimizer-suspend-amd

What it fixes: Parcel breaks isolation by always exposing modules, causing a "Mismatched anonymous define()" error. if script is loaded any other way than via require.

Background of this optimizer is the following issue: https://github.com/parcel-bundler/parcel/issues/2451

This plugin wraps your bundle to:

  1. Caches reference to global define object to avoid conflicts with other global define objects (such as AMD's define function) before your content
  2. Restores global define object after your content

Usage

// .parcelrc
{
  "extends": "@parcel/config-default",
  "optimizers": {
    "*.js": ["@parcel/optimizer-terser", "@phantom-labs/parcel-optimizer-suspend-amd"]
  }
}

Thanks

Inspired by

License

Apache 2.0 License