You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 21, 2021. It is now read-only.
There may be chunks that you don't want to have preloaded (sourcemaps, for example). Before preloading each chunk, this plugin checks that the file does not match any regex in the `fileBlacklist` option. The default value of this blacklist is `[/\.map/]`, meaning no sourcemaps will be preloaded. You can easily override this:
168
162
@@ -180,8 +174,7 @@ new PreloadWebpackPlugin({
180
174
})
181
175
```
182
176
183
-
Resource Hints
184
-
---------------------
177
+
### Resource Hints
185
178
186
179
Should you wish to use Resource Hints (such as `prefetch`) instead of `preload`, this plugin also supports wiring those up.
187
180
@@ -203,25 +196,23 @@ For the async chunks mentioned earlier, the plugin would update your HTML to the
A demo application implementing the [PRPL pattern](https://developers.google.com/web/fundamentals/performance/prpl-pattern/) with React that uses this plugin can be found in the `demo`
210
202
directory.
211
203
212
-
Support
213
-
-------
204
+
## Support
214
205
215
-
If you've found an error in this sample, please file an issue:
206
+
If you've found an error or run into problems, please file an issue:
Patches are encouraged, and may be submitted by forking this project and
219
210
submitting a pull request through GitHub.
220
211
221
-
Contributing workflow
222
-
---------------------
212
+
## Contributing workflow
223
213
224
-
`index.js` contains the primary source for the plugin, `test` contains tests and `demo` contains demo code.
214
+
`index.js` and `lib/` contains the primary source for the plugin,
215
+
`test` contains tests and `demo` contains demo code.
225
216
226
217
Test the plugin:
227
218
@@ -230,35 +221,34 @@ $ npm install
230
221
$ npm run test
231
222
```
232
223
233
-
Lint the plugin:
234
-
235
-
```sh
236
-
$ npm run lint
237
-
$ npm run lint-fix # fix linting issues
238
-
```
239
-
240
-
The project is written in ES2015, but does not use a build-step. This may change depending on
241
-
any Node version support requests posted to the issue tracker.
224
+
The project is written in ES2015, and is transpiled to support node 6 and above.
242
225
243
-
Additional Notes
244
-
---------------------------
226
+
## Additional notes
245
227
246
-
* Be careful not to `preload` resources a user is unlikely to need. This can waste their bandwidth.
247
-
* Use `preload` for the current session if you think a user is likely to visit the next page. There is no
228
+
- Be careful not to `preload` resources a user is unlikely to need. This can waste their bandwidth.
229
+
- Use `preload` for the current session if you think a user is likely to visit the next page. There is no
248
230
100% guarantee preloaded items will end up in the HTTP Cache and read locally beyond this session.
249
-
* If optimising for future sessions, use `prefetch` and `preconnect`. Prefetched resources are maintained
231
+
- If optimizing for future sessions, use `prefetch` and `preconnect`. Prefetched resources are maintained
250
232
in the HTTP Cache for at least 5 minutes (in Chrome) regardless of the resource's cachability.
251
233
252
-
Related plugins
253
-
--------------------------
234
+
## Alternative tools
235
+
236
+
- webpack's native support:
237
+
As of the [v4.6.0 release](https://github.com/webpack/webpack/releases/tag/v4.6.0)
238
+
of webpack, there is native support for generating both prefetch and preload `<link>`s via ["magic" comments in your `import()` statements](https://medium.com/webpack/link-rel-prefetch-preload-in-webpack-51a52358f84c).
Enhances `html-webpack-plugin` with options including 'async', 'defer', 'module' and 'preload'.
242
+
As of [v1.7.0](https://github.com/numical/script-ext-html-webpack-plugin/pull/9#issuecomment-278239875),
243
+
it supports async chunks.
254
244
255
-
*[script-ext-html-webpack-plugin](https://github.com/numical/script-ext-html-webpack-plugin) - Enhances html-webpack-plugin with options including 'async', 'defer', 'module' and preload (no async chunk support yet)
256
-
*[resource-hints-webpack-plugin](https://github.com/jantimon/resource-hints-webpack-plugin) - Automatically wires resource hints for your resources (similarly no async chunk support)
0 commit comments