sarsamurmu / reboost

A super fast dev server for rapid web development
MIT License
61 stars 3 forks source link

UsePlugin(singleArgument:{}) repetition #18

Closed GHNewbiee closed 4 years ago

GHNewbiee commented 4 years ago

UsePlugin({...}) accepts only one argument. Although more than once of it can be used in plugins options (I suspect so) (can't they?), don't you think that you don't stay DRY? Plugins are often declared once. I have seen this implementation also in snowpack scripts, lately! Wouldn't be better instead of:

plugins: [
    UsePlugin({
      include: /.(png|jpg|jpeg)$/i,
      use: FilePlugin()
    }),
    UsePlugin({
      include: /.*/,
      exclude: /node_modules/,
      use: BabelPlugin()
    }),
...

to write something like:

plugins: [
    UsePlugin(
      {
        include: /.(png|jpg|jpeg)$/i,
        use: FilePlugin()
      },
      {
        include: /.*/,
        exclude: /node_modules/,
        use: BabelPlugin()
      }),
...

or, in the form of UsePlugin([ {}, {}, ... ]).

sarsamurmu commented 4 years ago

Oh right! It would be nice to have this feature. Thanks for the suggestion :D

sarsamurmu commented 4 years ago

Added support for this in the latest version.