question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose webpack version in the `compiler` object passed to plugins

See original GitHub issue

Do you want to request a feature or report a bug? feature

What is the current behavior? When writing a plugin whose goal is compatibility with both the legacy and webpack v4 plugin system, it’s something of a manual process to determine which version of webpack we’re running under. It would likely involve loading the webpack/package.json that applies to the current compilation, and interpreting the data from there.

If the current behavior is a bug, please provide the steps to reproduce. n/a

What is the expected behavior? It would be much cleaner if the webpack version were exposed as a property of the compiler object, and passed through to plugins. The plugin would still need to know how to do semver comparisons, but at least it wouldn’t also need to know how to find the right package.json and parse it.

If this is a feature request, what is motivation or use case for changing the behavior? See https://github.com/GoogleChrome/workbox/issues/1151#issuecomment-360964776 for more context.

Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System. webpack v4

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
TheLarkInncommented, Jan 31, 2018

🙇

On Tue, Jan 30, 2018, 10:52 AM Jeffrey Posnick notifications@github.com wrote:

Thanks! 👍

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webpack/webpack/issues/6411#issuecomment-361695645, or mute the thread https://github.com/notifications/unsubscribe-auth/ADQBMGs0Ns8jjzdFT8zuu1_ihWup_33dks5tP2TWgaJpZM4RxRCe .

1reaction
ooflorentcommented, Jan 30, 2018

@jeffposnick should be enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing a Plugin - webpack
Plugins are instantiated objects with an apply method on their prototype. This apply method is called once by the webpack compiler while installing...
Read more >
Support for webpack 4 plugin system · Issue #1151 · GoogleChrome ...
Library Affected: workbox-webpack-plugin As mentioned in ... Expose webpack version in the compiler object passed to plugins webpack/webpack#6411.
Read more >
Extending with Plugins - SurviveJS
When the plugin is connected to webpack configuration, webpack will run its constructor and call apply with a compiler object passed to it....
Read more >
Passing environment-dependent variables in webpack
You just have to declare the plugin in your webpack.config.js file: var webpack = require('webpack'); module.exports ...
Read more >
Working with Webpack | Vue CLI
vue.config.js module.exports = { configureWebpack: { plugins: [ new ... The object will be merged into the final webpack config using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found