fastpack/fastpack

Add option for bundle file name

ryyppy opened this issue · 8 comments

I would like to be able to run fastpack multiple times, with different entry points and output each bundled file with a different filename in the same output folder.

it seems there is no option to give it a different name and it will always create the bundle as index.js.

Would you be interested to support a flag for this? Not sure about the flag name, but I would be happy to do a PR.

@ryyppy -n or --name is already added :)

hm weird, seems to be undocumented then... will try that, thanks!

It's documented in the readme. Is it missing in the executable --help section?

@gilbert in fact, the readme is a copy/paste of the --help, so it should be there as well

@gilbert @zindel aha, i see it in the README, but it's apparently missing on the website 😄

I was just trying to use this new flag as mentioned in this issue, multiple times, with different entry points and output each bundled file with a different filename in the same output folder.
On my machine (with version 0.8.4 (Commit: 365123f)), every run of fpack seems to delete everything else in the folder, so this workflow isn't working for me. Is that intended behavior?

@Schmavery yes, this is the intended behaviour - fastpack "owns" the output directory. The reason for it is that there may be (and likely will be) more files named internally by the fastpack (css, static assets, JS chunks), so we need a way to guarantee that the output is consistent with the latest state of the source code. -n option is added to provide the public API to the output - i.e. you can refer the bundle from the HTML file.

Could you give a little more details on your workflow where this strategy fails?