From f798b67f560298451ab093cb3132f12935766ab8 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 7 Apr 2023 11:17:48 +1200 Subject: [PATCH] fix: correctly export types for TS when used CommonJS --- .github/workflows/test.yml | 2 +- CHANGELOG.md | 5 + README.md | 184 ++++++++++++++++++------------------- package.json | 22 ++--- src/index.d.ts | 8 +- 5 files changed, 111 insertions(+), 110 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00ad55d..7854d53 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Running Code Coverage +name: Test on: [ push, pull_request ] diff --git a/CHANGELOG.md b/CHANGELOG.md index ff1d026..00f0996 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.0.2 (2023-04-07) +- fix: correctly export types for TS when used CommonJS +- chore: update dev packages +- docs: update readme + ## 1.0.1 (2022-09-19) - docs: update readme diff --git a/README.md b/README.md index 21ed95e..f43d8d5 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,10 @@ --- -[![npm](https://img.shields.io/npm/v/webpack-remove-empty-scripts/latest?logo=npm&color=brightgreen "npm package")](https://www.npmjs.com/package/webpack-remove-empty-scripts) +[![npm](https://img.shields.io/npm/v/webpack-remove-empty-scripts?logo=npm&color=brightgreen "npm package")](https://www.npmjs.com/package/webpack-remove-empty-scripts "download npm package") [![node](https://img.shields.io/node/v/webpack-remove-empty-scripts)](https://nodejs.org) [![node](https://img.shields.io/github/package-json/dependency-version/webdiscus/webpack-remove-empty-scripts/peer/webpack)](https://webpack.js.org/) +[![Test](https://github.com/webdiscus/webpack-remove-empty-scripts/actions/workflows/test.yml/badge.svg)](https://github.com/webdiscus/webpack-remove-empty-scripts/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/webdiscus/webpack-remove-empty-scripts/branch/master/graph/badge.svg)](https://codecov.io/gh/webdiscus/webpack-remove-empty-scripts) [![node](https://img.shields.io/npm/dm/webpack-remove-empty-scripts)](https://www.npmjs.com/package/webpack-remove-empty-scripts) @@ -33,96 +34,83 @@ This plugin removes an unexpected empty JS file. --- -## Usage with `html-webpack-plugin` +## Usage with html-webpack-plugin + +> **Warning** +> +> The `webpack-remove-empty-scripts` is the `Emergency Fix` for the `bug` in `mini-css-extract-plugin`. +> +> ✅ It is recommended to use the new powerful [html-bundler-webpack-plugin][html-bundler-webpack-plugin] instead of: +> +> - html-webpack-plugin +> - mini-css-extract-plugin +> - webpack-remove-empty-scripts + +### Highlights of html-bundler-webpack-plugin + +- **Prevents generating unexpected empty JS files.** +- An [entry point](https://github.com/webdiscus/html-bundler-webpack-plugin#option-entry) is an HTML template. +- Source **scripts** and **styles** can be specified directly in HTML using ` - - -

Hello World!

- - - + + + + + + + +

Hello World!

+ + + ``` -The generated HTML +The generated HTML contains the output filenames of the processed assets: + ```html - - - - - -

Hello World!

- - + + + + + +

Hello World!

+ + ``` -Simple Webpack config +Add the HTML templates in the `entry` option: + ```js -const path = require('path'); const HtmlBundlerPlugin = require('html-bundler-webpack-plugin'); + module.exports = { - output: { - path: path.join(__dirname, 'dist/'), - }, - entry: { - // define templates here - index: './src/views/index.html', // => dist/index.html - 'pages/about': './src/views/about/index.html', // => dist/pages/about.html - // ... - }, plugins: [ new HtmlBundlerPlugin({ - js: { - // output filename of extracted JS from source script loaded in HTML via `