Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack v3 support #74

Closed
etripier opened this issue Feb 27, 2019 · 2 comments · Fixed by #77
Closed

Webpack v3 support #74

etripier opened this issue Feb 27, 2019 · 2 comments · Fixed by #77

Comments

@etripier
Copy link

First off: I'm a huge fan of the plugin and Terser in general. It's always nice when things run faster and produce better results.

Feature Proposal

I know the issue title is probably going to elicit some groans, but it doesn't seem like much is preventing this plugin from working on Webpack v3. I think it might just involve modifying the index file like so:

if (compiler.hooks) {
  ...
} else {
  compiler.plugin('compilation', (compilation) => {
    if (this.options.sourceMap) {
      compilation.plugin('build-module', buildModuleFn);
    }
    compilation.plugin('optimize-chunk-assets', optimizeFn.bind(this, compilation));
  });
}

We'd lose out on the contenthash regeneration, but I don't think that's breaking for Webpack v3 users (or at least, we're used to the problem).

For those of us stuck with older versions of Webpack, this would significantly improve our build times and give us a sample of the benefits of v4!

I'd be happy to open a PR to make the needed changes if the idea seems appealing.

Feature Use Case

This would be very helpful for developers stuck in the year 2016.

@alexander-akait
Copy link
Member

@etripier we officially don't support webpack@3, anyway you can send a PR and we can release this under terser-webpack-plugin-legacy name with supporting webpack@3. Anyway we strongly recommendation update webpack, because webpack@5 will have some changes and it was incompatibility with webpack@3

@alexander-akait
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants