-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
383 additions
and
5,488 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
node_modules/ | ||
dist/ | ||
|
||
spec/test_dist | ||
node_modules/ | ||
dist/ | ||
|
||
spec/test_dist | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
src/ | ||
spec/ | ||
node_modules/ | ||
.vscode/ | ||
.gitignore | ||
npm-debug.log | ||
tsconfig.json | ||
.travis.yml | ||
src/ | ||
spec/ | ||
node_modules/ | ||
.vscode/ | ||
.gitignore | ||
npm-debug.log | ||
tsconfig.json | ||
.travis.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
language: node_js | ||
node_js: | ||
- "8" | ||
- "10" | ||
- "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 | ||
- npm install -D webpack@$WEBPACK_VERSION || true | ||
- npm install -D html-webpack-plugin@$HTML_PLUGIN_VERSION || true | ||
|
||
script: | ||
- npm test | ||
- npm run build | ||
|
||
deploy: | ||
skip_cleanup: true | ||
on: | ||
repo: swimmadude66/webpack-nomodule-plugin | ||
node: "10" | ||
tags: true | ||
branch: master | ||
if: env(WEBPACK_VERSION)=4 AND env(HTML_PLUGIN_VERSION)=3 | ||
provider: npm | ||
email: "[email protected]" | ||
api_key: | ||
secure: "KLe0spEfJBgExBmnB4fAo6L8s9CclKFKU8rcnsNhbuGsJdqowkmcj4ahNf5lAm94Acral+ui2Ir+McAvfi5R6KIysNFnhEtMfMTQQ+1IwhRD6AfOGdEsjWFuLb9yVwAVSq5NSxa/G/fIW+0Zp/bWWiltURLjsWwJhtBbaij4/16Chu5VHZ5LX2TU5F1TJCjJqNQfh2pZH6Xh05j+FvaIaC0WIre3ZKpm0mdJJY241+dzynXw3ctVSHopR2WvzVyXbtR+/M/S4NfrgGwk0RV8KHfGjGbIxwpfuzbTvcPfQkbso6Y6ysy6EwWXbPt9qIQP7okVU8nSI7rq5m3pKlq94dKENkeEGCcOzBvKzmNHwsLPIYBbwhkQZ4ELe1OOFe+9mLih6QU4e+/nALsORF28vTFd4b5jzJq0i/Fpx6EleKqh0yeL9rVuD4KDAEdVDyqGMzIBkleS3nJE+Hs+7EQmL6UXuKUh1ttpHMNQ8zPaDmo4lMy8MYM3kKoUUxKxZ8GcjdgDJSqLMg2oR2KDu1HItXl/M4JzbjzRAf1+T3jwprpJgIJoq4nHLQHFpgH26T3Ue4UCCztHe6NIE0qD+OId8fI+QTUo3Ju+sng/oR4NUdTaW7SSrrB4ts2g5CX/2cuGBv2yWTjcfhjtDLLcYAnONJS5mhO7aAGi4F+3JCJArms=" | ||
language: node_js | ||
node_js: | ||
- "8" | ||
- "10" | ||
- "12" | ||
|
||
env: | ||
- WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=3 | ||
- WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=4 | ||
- WEBPACK_VERSION=4 HTML_PLUGIN_VERSION=5 | ||
- WEBPACK_VERSION=5 HTML_PLUGIN_VERSION=5 | ||
|
||
install: | ||
- npm install | ||
- npm install -D webpack@$WEBPACK_VERSION || true | ||
- npm install -D html-webpack-plugin@$HTML_PLUGIN_VERSION || true | ||
|
||
script: | ||
- npm test | ||
- npm run build | ||
|
||
deploy: | ||
skip_cleanup: true | ||
on: | ||
repo: swimmadude66/webpack-nomodule-plugin | ||
node: "10" | ||
tags: true | ||
branch: master | ||
if: env(WEBPACK_VERSION)=4 AND env(HTML_PLUGIN_VERSION)=3 | ||
provider: npm | ||
email: "[email protected]" | ||
api_key: | ||
secure: "KLe0spEfJBgExBmnB4fAo6L8s9CclKFKU8rcnsNhbuGsJdqowkmcj4ahNf5lAm94Acral+ui2Ir+McAvfi5R6KIysNFnhEtMfMTQQ+1IwhRD6AfOGdEsjWFuLb9yVwAVSq5NSxa/G/fIW+0Zp/bWWiltURLjsWwJhtBbaij4/16Chu5VHZ5LX2TU5F1TJCjJqNQfh2pZH6Xh05j+FvaIaC0WIre3ZKpm0mdJJY241+dzynXw3ctVSHopR2WvzVyXbtR+/M/S4NfrgGwk0RV8KHfGjGbIxwpfuzbTvcPfQkbso6Y6ysy6EwWXbPt9qIQP7okVU8nSI7rq5m3pKlq94dKENkeEGCcOzBvKzmNHwsLPIYBbwhkQZ4ELe1OOFe+9mLih6QU4e+/nALsORF28vTFd4b5jzJq0i/Fpx6EleKqh0yeL9rVuD4KDAEdVDyqGMzIBkleS3nJE+Hs+7EQmL6UXuKUh1ttpHMNQ8zPaDmo4lMy8MYM3kKoUUxKxZ8GcjdgDJSqLMg2oR2KDu1HItXl/M4JzbjzRAf1+T3jwprpJgIJoq4nHLQHFpgH26T3Ue4UCCztHe6NIE0qD+OId8fI+QTUo3Ju+sng/oR4NUdTaW7SSrrB4ts2g5CX/2cuGBv2yWTjcfhjtDLLcYAnONJS5mhO7aAGi4F+3JCJArms=" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Adam Yost | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
MIT License | ||
Copyright (c) 2021 Adam Yost | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
# Webpack Nomodule Plugin | ||
_Assigns the `nomodule` attribute to script tags injected by [Html Webpack Plugin](https://github.com/jantimon/html-webpack-plugin)_ | ||
|
||
## Configuration | ||
|
||
1. Install via `npm i -D webpack-nomodule-plugin` | ||
1. Add to your webpack config AFTER HtmlWebpackPlugin | ||
```javascript | ||
var NoModulePlugin = require('webpack-nomodule-plugin').WebpackNoModulePlugin; | ||
// OR for import style | ||
import {WebpackNoModulePlugin} from 'webpack-nomodule-plugin' | ||
... | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
filename: join(OUTPUT_DIR, './dist/index.html'), | ||
hash: false, | ||
inject: 'body', | ||
minify: minifyOptions, | ||
showErrors: false | ||
template: join(__dirname, './src/index.html'), | ||
}), | ||
new WebpackNoModulePlugin({ | ||
filePatterns: ['polyfill.**.js'] | ||
}) | ||
] | ||
``` | ||
|
||
The plugin takes a configuration argument with a key called `filePatterns`. This is an array of file globs (provided via [minimatch](https://github.com/isaacs/minimatch)) representing which injected script tags to flag as nomodule. **Scripts with this attribute will not be executed on newer browsers, so IE and other browser polyfills can be skipped if not needed.** | ||
|
||
|
||
## Testing | ||
Testing is done via ts-node and mocha. Test files can be found in `/spec`, and will be auto-discovered as long as the file ends in `.spec.ts`. Just run `npm test` after installing to see the tests run. | ||
# Webpack Nomodule Plugin | ||
_Assigns the `nomodule` attribute to script tags injected by [Html Webpack Plugin](https://github.com/jantimon/html-webpack-plugin)_ | ||
|
||
[](https://travis-ci.org/swimmadude66/webpack-nomodule-plugin) | ||
|
||
## Configuration | ||
|
||
1. Install via `npm i -D webpack-nomodule-plugin` | ||
1. Add to your webpack config AFTER HtmlWebpackPlugin | ||
```javascript | ||
var NoModulePlugin = require('webpack-nomodule-plugin').WebpackNoModulePlugin; | ||
// OR for import style | ||
import {WebpackNoModulePlugin} from 'webpack-nomodule-plugin' | ||
... | ||
plugins: [ | ||
new HtmlWebpackPlugin({ | ||
filename: join(OUTPUT_DIR, './dist/index.html'), | ||
hash: false, | ||
inject: 'body', | ||
minify: minifyOptions, | ||
showErrors: false | ||
template: join(__dirname, './src/index.html'), | ||
}), | ||
new WebpackNoModulePlugin({ | ||
filePatterns: ['polyfill.**.js'] | ||
}) | ||
] | ||
``` | ||
|
||
The plugin takes a configuration argument with a key called `filePatterns`. This is an array of file globs (provided via [minimatch](https://github.com/isaacs/minimatch)) representing which injected script tags to flag as nomodule. **Scripts with this attribute will not be executed on newer browsers, so IE and other browser polyfills can be skipped if not needed.** | ||
|
||
|
||
## Testing | ||
Testing is done via ts-node and mocha. Test files can be found in `/spec`, and will be auto-discovered as long as the file ends in `.spec.ts`. Just run `npm test` after installing to see the tests run. |
Oops, something went wrong.