Webpack-cli: [FEATURE]: Option to switch between versions of webpack

Created on 25 Mar 2021  路  5Comments  路  Source: webpack/webpack-cli

I'm working on a Vue 2 project, which needs webpack v4 deep in its internals. It seems unlikely I'll be able to update any time soon. However for a new entry point, I'd like to use v5. I was able to install both v4 and v5 using package.json npm aliases:

"webpack": "^4.0.0",
"webpack5": "npm:webpack@^5.28.0",
"webpack-cli": "^4.5.0"

It would be wonderful if I could somehow configure webpack-cli to use webpack5 some of the time.

Describe the solution you'd like

An environment variable seems like an ok option? Something like: WEBPACK_PACKAGE=webpack5 npx webpack version. A wepback-cli option itself could also work, but seems more difficult to implement.

Describe alternatives you've considered

Additional context

Feature Request

Most helpful comment

Make sense, PR welcome

All 5 comments

The approach looks good but ideally, it would be best if tools migrate to webpack 5 instead

/cc @alexander-akait what do you think?

Make sense, PR welcome

i will send a PR

Awesome! Thank you @snitin315 @alexander-akait @anshumanv ! That was some lightning fast turn around :)

And it's released and usable in under a week! Y'all are awesome!

Was this page helpful?
0 / 5 - 0 ratings