diff --git a/.changeset/odd-pets-type.md b/.changeset/odd-pets-type.md new file mode 100644 index 00000000..f53ba5a8 --- /dev/null +++ b/.changeset/odd-pets-type.md @@ -0,0 +1,5 @@ +--- +'microbundle': patch +--- + +Add support for configuration overrides using the `publishConfig` package.json field. diff --git a/README.md b/README.md index c973e8cc..f09c0491 100644 --- a/README.md +++ b/README.md @@ -36,17 +36,18 @@ 2ī¸âƒŖ **Set up** your `package.json`: -```js +```jsonc { - "name": "foo", // your package name - "source": "src/foo.js", // your source code - "main": "dist/foo.js", // where to generate the CommonJS/Node bundle - "exports": "./dist/foo.modern.js", // path to the modern output (see below) - "module": "dist/foo.module.js", // where to generate the ESM bundle - "unpkg": "dist/foo.umd.js", // where to generate the UMD bundle (also aliased as "umd:main") + "name": "foo", // your package name + "type": "module", + "source": "src/foo.js", // your source code + "exports": "./dist/foo.modern.js", // where to generate the modern bundle (see below) + "main": "./dist/foo.cjs", // where to generate the CommonJS bundle + "module": "./dist/foo.module.js", // where to generate the ESM bundle + "unpkg": "./dist/foo.umd.js", // where to generate the UMD bundle (also aliased as "umd:main") "scripts": { - "build": "microbundle", // compiles "source" to "main"/"module"/"unpkg" - "dev": "microbundle watch" // re-build when source files change + "build": "microbundle", // compiles "source" to "main"/"module"/"unpkg" + "dev": "microbundle watch" // re-build when source files change } } ``` @@ -55,11 +56,18 @@ ## đŸ’Ŋ Output Formats -Microbundle produces esm, cjs, umd bundles with your code compiled to syntax that works pretty much everywhere. While it's possible to customize the browser or Node versions you wish to support using a [browserslist configuration](https://github.com/browserslist/browserslist#browserslist-), the default setting is optimal and strongly recommended. +Microbundle produces esm, cjs, umd bundles with your code compiled to syntax that works pretty much everywhere. +While it's possible to customize the browser or Node versions you wish to support using a [browserslist configuration](https://github.com/browserslist/browserslist#browserslist-), the default setting is optimal and strongly recommended. ## 🤖 Modern Mode -In addition to the above formats, Microbundle also outputs a `modern` bundle specially designed to work in _all modern browsers_. This bundle preserves most modern JS features when compiling your code, but ensures the result runs in 95% of web browsers without needing to be transpiled. Specifically, it uses [preset-modules](https://github.com/babel/preset-modules) to target the set of browsers that support `