Skip to content

Commit

Permalink
breaking: replace default export with named export CleanWebpackPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisblossom committed May 22, 2019
1 parent b74ac15 commit eddc38c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 16 deletions.
11 changes: 0 additions & 11 deletions .babelrc.js
Expand Up @@ -14,17 +14,6 @@ const babel = {
],
'@babel/preset-typescript',
],
overrides: [
{
test: ['./src/clean-webpack-plugin.ts'],
plugins: [
[
'babel-plugin-add-module-exports',
{ addDefaultProperty: true },
],
],
},
],
};

module.exports = babel;
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -34,7 +34,7 @@ By default, this plugin will remove all files inside webpack's `output.path` dir
## Usage

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

const webpackConfig = {
plugins: [
Expand Down Expand Up @@ -126,7 +126,7 @@ new CleanWebpackPlugin({
This is a modified version of [WebPack's Plugin documentation](https://webpack.js.org/concepts/plugins/) that includes the Clean Plugin.

```js
const CleanWebpackPlugin = require('clean-webpack-plugin'); // installed via npm
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); // installed via npm
const HtmlWebpackPlugin = require('html-webpack-plugin'); // installed via npm
const webpack = require('webpack'); // to access built-in plugins
const path = require('path');
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -58,7 +58,6 @@
"@types/node": "^12.0.2",
"@types/read-pkg-up": "^3.0.1",
"babel-jest": "^24.8.0",
"babel-plugin-add-module-exports": "^1.0.2",
"codecov": "^3.5.0",
"cross-env": "^5.2.0",
"del-cli": "^1.1.0",
Expand Down
3 changes: 2 additions & 1 deletion src/clean-webpack-plugin.test.ts
Expand Up @@ -46,7 +46,8 @@ function webpack(options: Configuration = {}) {
}

const CleanWebpackPlugin: any = function CleanWebpackPlugin(...args: any) {
const CleanWebpackPluginActual = require('./clean-webpack-plugin');
const CleanWebpackPluginActual = require('./clean-webpack-plugin')
.CleanWebpackPlugin;
const cleanWebpackPlugin = new CleanWebpackPluginActual(...args);
return cleanWebpackPlugin;
};
Expand Down
2 changes: 1 addition & 1 deletion src/clean-webpack-plugin.ts
Expand Up @@ -347,4 +347,4 @@ class CleanWebpackPlugin {
}
}

export default CleanWebpackPlugin;
export { CleanWebpackPlugin };

0 comments on commit eddc38c

Please sign in to comment.