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 5144ad4..b8b2bdc 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/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 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": { 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) => {