Skip to content

Commit

Permalink
Merge pull request #2 from swimmadude66/dev
Browse files Browse the repository at this point in the history
Merge in readme fix, plus actual config type and updated package-lock
  • Loading branch information
swimmadude66 authored May 12, 2019
2 parents 9d38401 + aa0b64d commit 48e04bb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ src/
spec/
node_modules/
.vscode/
.gitignore
npm-debug.log
tsconfig.json
.travis.yml
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 README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 48e04bb

Please sign in to comment.