From 2916149ec7272ac8b4fbce6f1cf5f40de61218d5 Mon Sep 17 00:00:00 2001 From: Adam Yost Date: Fri, 10 May 2019 23:05:00 -0400 Subject: [PATCH 1/4] [skip ci] From e9a9893dab0577d04481abc7910d51279de50756 Mon Sep 17 00:00:00 2001 From: Atanas Atanasov Date: Sun, 12 May 2019 13:42:23 +0300 Subject: [PATCH 2/4] Fix attribute name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94dd1b0..1c1ecf8 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Webpack Nomodule Plugin -_Assigns the nodmodule attribute to script tags injected by [Html Webpack Plugin](https://github.com/jantimon/html-webpack-plugin)_ +_Assigns the `nomodule` attribute to script tags injected by [Html Webpack Plugin](https://github.com/jantimon/html-webpack-plugin)_ ## Configuration From e70673b3463b28a6333e4d76065bf3e94a84cf99 Mon Sep 17 00:00:00 2001 From: Adam Yost Date: Sun, 12 May 2019 09:30:53 -0400 Subject: [PATCH 3/4] add test case for webpack 5 --- .travis.yml | 3 +-- package.json | 2 +- src/plugin.ts | 11 ++++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5144ad4..2932d9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,13 @@ language: node_js node_js: - "8" - - "9" - "10" - - "11" - "12" env: - WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=3 - WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=next + - WEBPACK_VERSION=5.0.0-alpha.12 HTML_PLUGIN_VERSION=next install: - npm install diff --git a/package.json b/package.json index e9cd44b..18b3d89 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-nomodule-plugin", - "version": "1.0.0", + "version": "1.0.1", "description": "a plugin for html-webpack-plugin to label certain chunks as legacy-only via the nomodule attribute", "main": "dist/plugin.js", "scripts": { diff --git a/src/plugin.ts b/src/plugin.ts index c728a76..8ab9471 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,9 +1,14 @@ import * as HtmlWebpackPlugin from 'html-webpack-plugin'; import * as minimatch from 'minimatch'; +export type NoModuleConfig = { + filePatterns: string[]; + // in case I want to add other optional configs later without breaking old uses +} + export class WebpackNoModulePlugin { - constructor(private _config: {filePatterns: string[]} = {filePatterns: []}) { + constructor(private _config: NoModuleConfig = {filePatterns: []}) { } @@ -21,9 +26,9 @@ export class WebpackNoModulePlugin { return cb(null, data); } ) - } else if (HtmlWebpackPlugin && HtmlWebpackPlugin['getHooks']) { + } else if (HtmlWebpackPlugin && HtmlWebpackPlugin.getHooks) { // html-webpack 4 - const hooks = (HtmlWebpackPlugin as any).getHooks(compilation); + const hooks = HtmlWebpackPlugin.getHooks(compilation); hooks.alterAssetTags.tapAsync( 'NoModulePlugin', (data, cb) => { From aa0b64daff4021bff83652dbd7e91482281b270c Mon Sep 17 00:00:00 2001 From: Adam Yost Date: Sun, 12 May 2019 09:46:00 -0400 Subject: [PATCH 4/4] not webpack 5 compatible at present --- .npmignore | 1 + .travis.yml | 2 +- package-lock.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index c9c2bea..76702f1 100644 --- a/.npmignore +++ b/.npmignore @@ -2,6 +2,7 @@ src/ spec/ node_modules/ .vscode/ +.gitignore npm-debug.log tsconfig.json .travis.yml diff --git a/.travis.yml b/.travis.yml index 2932d9f..b8b2bdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ node_js: env: - WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=3 - WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=next - - WEBPACK_VERSION=5.0.0-alpha.12 HTML_PLUGIN_VERSION=next + # - WEBPACK_VERSION=5.0.0-alpha.12 HTML_PLUGIN_VERSION=next install: - npm install diff --git a/package-lock.json b/package-lock.json index abb5d35..dbd32f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "webpack-nomodule-plugin", - "version": "0.0.0", + "version": "1.0.1", "lockfileVersion": 1, "requires": true, "dependencies": {