Microbundle: How to specify the name of the generated output file?

Created on 9 Sep 2018  ·  7Comments  ·  Source: developit/microbundle

I'm using microbundle this way:

microbundle build --entry js/mod-processor.js -o dist

It works but generates a file called dist/modplayer-js.js, modplayer-js being the name of my package/directory.

Is there a way to specify the name of the output file?

Most helpful comment

You can currently set the output name as x.js which will make it take the name of the input file

All 7 comments

@warpdesign I think you're supposed to specify the names in the package.json like so: https://github.com/developit/microbundle#specifying-builds-in-packagejson

Sure, but what if I want to build only a single file that's part of my build but isn't the name of the whole package?

How about adding an option to specify the name/prefix of the output file?

@warpdesign I have the same issue. Did you find a solution?

You can currently set the output name as x.js which will make it take the name of the input file

I am wondering the same thing, but can’t figure out how to define these in the package.json file. Are these named output values added to root of package.json, or should they be under another property. The information in the readme is not clear?

If you could please clarify here

https://github.com/developit/microbundle#specifying-builds-in-packagejson

Specifying the filename as part of output commands works to me

❯ npx microbundle build -o dist/index.js --no-compress --no-sourcemap --name "@microlink/react"

Build "@microlink/react" to dist:
      15.4 kB: index.js.gz
      13.4 kB: index.js.br
      15.3 kB: index.mjs.gz
      13.4 kB: index.mjs.br
      15.5 kB: index.umd.js.gz
      13.6 kB: index.umd.js.br
Was this page helpful?
0 / 5 - 0 ratings

Related issues

artemtam picture artemtam  ·  19Comments

Andarist picture Andarist  ·  33Comments

peter-mouland picture peter-mouland  ·  12Comments

gamtiq picture gamtiq  ·  28Comments

smithki picture smithki  ·  19Comments