microbundle 0.12.0 outputs *.modern.js without prompting

Created on 10 May 2020  Â·  3Comments  Â·  Source: developit/microbundle

Hello! 👋

I don't know if this was a regression or on purpose, but 0.12.0 seems to no longer honor what I've listed in my package.json and outputs an extra *.modern.js file. My input package.json:

{
  "name": "a-local-module",
  "private": true,
  "main": "dist/client.js",
  "module": "dist/client.mjs",
  "umd:main": "dist/client.umd.js",
  "source": "src/index.js"
}

I know that's a new feature (and one I want to use!) but I'm confused on how to prevent it from outputting that file in situations where I don't want it.

One potential twist — I'm running this from somewhere else and targeting this directory with cwd. The command I'm running:

microbundle build --cwd client
question

Most helpful comment

-f, --format Only build specified formats (any of modern,es,cjs,umd or iife) (default modern,es,cjs,umd)

you can pass -f es,cjs,umd if you don't want the modern output

All 3 comments

-f, --format Only build specified formats (any of modern,es,cjs,umd or iife) (default modern,es,cjs,umd)

you can pass -f es,cjs,umd if you don't want the modern output

yep yep - we just changed the default list to include modern, but manually specifying it will avoid it being generated.

Ah, gotcha! Thanks!

Am I misremembering that microbundle used to only create what it found in the package.json or was it an accidental coincidence that what I thought it did happened to match the previous defaults? 😅

Was this page helpful?
0 / 5 - 0 ratings