JSPM

webpack-modules

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6142
  • Score
    100M100P100Q119246F
  • License MIT

Handle ".mjs" files correctly

Package Exports

  • webpack-modules

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (webpack-modules) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

webpack-modules

Handle .mjs files correctly

Because webpack does it wrong and won't fix it.

Without this plugin, .mjs files will only consider other .mjs files as ESM. It completely disregards any .js files in the ESM format, forcing them to seen & treated as CommonJS modules (despite their contents). (comment)

Additionally, without this plugin, .mjs files do not follow the same resolve.mainFields sequence that's defined in your main configuration. (comment)

Usage

The plugin takes no options. Simply require it and invoke like any other plugin~

// webpack.config.js
const WebpackModules = require('webpack-modules');

module.exports = {
  // ...
  plugins: [
    new WebpackModules()
  ]
}

Credits

Thank you to @ForsakenHarmony who did the research and legwork as part of preact-cli – via this and that.

License

MIT © Luke Edwards