Skip to content

Commit

Permalink
add test case for webpack 5
Browse files Browse the repository at this point in the history
  • Loading branch information
swimmadude66 committed May 12, 2019
1 parent d7c9113 commit e70673b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
11 changes: 8 additions & 3 deletions src/plugin.ts
Original file line number Diff line number Diff line change
@@ -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: []}) {

}

Expand All @@ -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) => {
Expand Down

0 comments on commit e70673b

Please sign in to comment.