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

replace default export with named export CleanWebpackPlugin #138

Merged
merged 1 commit into from May 23, 2019

Conversation

chrisblossom
Copy link
Collaborator

Please hold off on merging this as it is a breaking change.

#114 (comment)
Oh, this lib is written in TS, I thought it just had a d.ts file. Then I would not change anything and just document the fact that consumers needs to add .default if their IDE/typechecker is yelling at them. The interop with CJS will always be a bit painful/ugly I think.

Jest will move to ES module exports in the next major and ditch export =.

One thing you can do is have a named export in addition to the default one, so people can do const CleanPlugin = require('clean-webpack-plugin').plugin; or something. Not much of a difference, but looks better than default, at least to my eyes

This PR removes the default export and replaces it with a named export CleanWebpackPlugin. It will work better with editors, improved es module/common js interoperability, and removes the (barely maintained) plugin babel-plugin-add-module-exports.

To upgrade users will need to update how they require/import the plugin.

// es modules
import { CleanWebpackPlugin } from 'clean-webpack-plugin';

// common js
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

This will also fix #114.

I personally think this is a good/future proof change. Thoughts?

@codecov-io
Copy link

codecov-io commented May 7, 2019

Codecov Report

Merging #138 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #138   +/-   ##
=======================================
  Coverage   98.86%   98.86%           
=======================================
  Files           1        1           
  Lines          88       88           
  Branches       30       30           
=======================================
  Hits           87       87           
  Misses          1        1
Impacted Files Coverage Δ
src/clean-webpack-plugin.ts 98.86% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b74ac15...d0e3408. Read the comment docs.

@chrisblossom chrisblossom merged commit f2e58bf into johnagan:master May 23, 2019
@chrisblossom chrisblossom deleted the use-named-export branch May 23, 2019 04:28
foolip added a commit to GoogleChromeLabs/confluence that referenced this pull request Jun 3, 2019
foolip pushed a commit to GoogleChromeLabs/confluence that referenced this pull request Jun 3, 2019
* Update dependency clean-webpack-plugin to v3

* Adapt to johnagan/clean-webpack-plugin#138
edmorley added a commit to neutrinojs/neutrino that referenced this pull request Jun 9, 2019
edmorley pushed a commit to neutrinojs/neutrino that referenced this pull request Jun 9, 2019
And add custom initialiser to account for this upstream change:
johnagan/clean-webpack-plugin#138
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 this pull request may close these issues.

Documentation example seems wrong
3 participants