Skip to content

Commit 868d145

Browse files
authored
fix: Drop default export to fix CommonJS (#34)
Sadly this is a breaking change but no can do. Related: microsoft/TypeScript#2719.
1 parent 55e410a commit 868d145

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ npm install mini-html-webpack-plugin
1313
```
1414

1515
```javascript
16-
const MiniHtmlWebpackPlugin = require('mini-html-webpack-plugin');
16+
const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');
1717

1818
const config = {
1919
plugins: [
@@ -57,7 +57,7 @@ It's possible to use `MiniHtmlWebpackPlugin` to develop sites with multiple page
5757
To achieve this, you'll have to define `entry` against each the code for each page and define `MiniHtmlWebpackPlugin` to match them. In practice you might want to abstract this pairing but to give you the full idea, consider the example below.
5858

5959
```javascript
60-
const MiniHtmlWebpackPlugin = require('mini-html-webpack-plugin');
60+
const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');
6161

6262
const config = {
6363
entry: {
@@ -81,7 +81,7 @@ const config = {
8181
8282
```javascript
8383
const minify = require('html-minifier').minify;
84-
const MiniHtmlWebpackPlugin = require('mini-html-webpack-plugin');
84+
const { MiniHtmlWebpackPlugin } = require('mini-html-webpack-plugin');
8585

8686
const config = {
8787
plugins: [
@@ -105,12 +105,12 @@ Or define a template function to generate your own code.
105105
The template function may return a string or a `Promise` resolving to a string.
106106
107107
```js
108-
const MiniHtmlWebpackPlugin = require('mini-html-webpack-plugin');
109108
const {
109+
MiniHtmlWebpackPlugin,
110110
generateAttributes,
111111
generateCSSReferences,
112112
generateJSReferences
113-
} = MiniHtmlWebpackPlugin;
113+
} = require('mini-html-webpack-plugin');
114114

115115
const config = {
116116
plugins: [

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class MiniHtmlWebpackPlugin implements webpack.Plugin {
179179
}
180180

181181
export {
182-
MiniHtmlWebpackPlugin as default,
182+
MiniHtmlWebpackPlugin,
183183
defaultTemplate,
184184
generateAttributes,
185185
generateCSSReferences,

test/plugin.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
2-
import MiniHtmlWebpackPlugin from '../src';
2+
import { MiniHtmlWebpackPlugin } from '../src';
33
import compiler from '@webpack-contrib/test-utils';
44

55
const getConfig = (options: {}, config: { title?: string } = {}) =>

0 commit comments

Comments
 (0)