webpack icon indicating copy to clipboard operation
webpack copied to clipboard

passing multiple files for a single entry point from CLI

Open georgir opened this issue 10 years ago • 4 comments

Currently there seems to be no way to pass multiple files for --entry arg. The way to pass structured data that is built-in in optimist with dot notation causes an error in ifArgPair's use of indexOf: webpack --entry.z ./a.js --entry.z ./b.js --output-filename z

But since you do not use the built-in support for dot notation for other options (i.e. --output-filename instead of --output.filename) perhaps this should be implemented in a custom way too, to be consistent?

webpack --entry-z ./a.js --entry-z ./b.js --output-filename z ?

webpack --entry z=./a.js --entry z=./b.js --output-filename z ? (currently the last one overwrites the first)

webpack --entry z=./a.js:./b.js --output-filename z ? (using local system specific path.delimiter? or allow both ; and : regardless of os? or allow even more natural options, like , or space, but that might lead to inability to reference files that contain those)

georgir avatar May 27 '16 12:05 georgir

yargs supports dot notation and array parameters. We should support this in our CLI.

sokra avatar Sep 01 '16 09:09 sokra

PR #4305 allows for the originally requested feature of multiple files in an entry. I also played with array parameters and dot notation as suggested by sokra.

Array parameters would introduce a breaking change.

Right now assuming output.filename="[name].js"

webpack --entry ./a.js ./b.js

results in:

a.js -> null.js
b.js -> main.js

if --entry was an array parameter we would get:

a.js, b.js -> null.js

It seems strange that an unnamed entry point becomes null.js and non-hyphanated arg gets put into main.js. Is that actually a bug? If so then array parameters would not be a breaking change. All files in unnamed entry points would be placed in the main chunk.

I didn't add dot notation support because named entry points were already supported. It could be added if you really think it's valuable.

webpack --entry foo=./a.js

would be equivalent to

webpack --entry.foo = ./a.js

rrharvey avatar Feb 18 '17 01:02 rrharvey

This issue had no activity for at least half a year.

It's subject to automatic issue closing if there is no activity in the next 15 days.

webpack-bot avatar Aug 19 '17 11:08 webpack-bot

Issue was closed because of inactivity.

If you think this is still a valid issue, please file a new issue with additional information.

webpack-bot avatar Sep 03 '17 14:09 webpack-bot