preload-webpack-plugin icon indicating copy to clipboard operation
preload-webpack-plugin copied to clipboard

Please use https://github.com/vuejs/preload-webpack-plugin instead.

Results 59 preload-webpack-plugin issues
Sort by recently updated
recently updated
newest added

While html-webpack-plugin has a config for generating XHTML code, this plugin, which is often used in conjunction with html-webpack-plugin produces only HTML tags. If the plugin were to generate self-closing...

See: - https://github.com/WICG/priority-hints/blob/master/EXPLAINER.md - https://github.com/WICG/priority-hints/blob/master/EXAMPLES.md I'd imagine there is some opportunity to add in support for automatically setting priorities when we can safely do so, but also allowing folks to...

enhancement

This is a cool plugin, thanks to the author, But I have a question, how can I go to Preload my Chunks as needed? I hope to set the Preload...

I think it's very important to be able to exclude specific chunks from the prefetch. A common use case is a chunk handling the admin route in the web app...

Continuation of #35. If I have two chunks ("foo" and "bar)" loading one asset using file-loader each ("foo.png" and "bar.png") with an HtmlWebpackPlugin each ("foo.html" and "bar.html"), I want "foo.html"...

Toggle preload/prefetch based on chunk.initial (or a callback)

[{"_id":"634738288402fb318b71e7b6","body":"Thanks for filing this issue, @jeffposnick. You're correct that the current implementation enforces a \"choose one or the other\" decision and there are opportunities supporting a mix of the two could enable that are worth us exploring. I'm quite open to us looking at a better model.\r\n\r\n> I'm in favor of changing the way rel works as follows:\r\n\r\n> If a string rel value is specified in the config, then always use that for all <link>s.\r\n> If no rel value is specified in the config, then use chunk.initial ? 'preload' : 'prefetch' to determine the rel value for each <link>.\r\n> If a function rel value is specified in the config, then pass in the file path and chunk and use the return value to determine the rel value for each <link>. (This is similar to what as supports, but instead of being passed just the file path, you'd also pass in the chunk.)\r\n\r\nOn first glances, this proposal sounds quite reasonable to me. I might have a little more feedback once we've been able to try out an implementation against a real Webpack project to see whether our assumptions above hold well. Would you be open to trying out the above in a branch? \ud83d\ude04 \r\n","issue_id":1660458738771,"origin_id":344982546,"user_origin_id":110953,"create_time":1510850525,"update_time":1510850525,"id":1665611816961,"updated_at":"2022-10-12T21:56:56.961000Z","created_at":"2022-10-12T21:56:56.961000Z"}] comment

The current plugin requires that you choose between a single `rel: 'preload'` or `rel: 'prefetch'` value that applies to all of the ``s. The problem is that `rel="preload"` is appropriate...

breaking-change

Include + Sourcemaps not working correctly

[{"_id":"6347415cb918e158f3161117","body":"I believe this issue should now be addressed as of https:\/\/github.com\/GoogleChrome\/preload-webpack-plugin\/pull\/22. Could you verify if there's more to be fixed here, @tbgse?","issue_id":1660458738774,"origin_id":323619398,"user_origin_id":110953,"create_time":1503272451,"update_time":1503272451,"id":1665614172568,"updated_at":"2022-10-12T22:36:12.568000Z","created_at":"2022-10-12T22:36:12.568000Z"}] comment

Hi, when you are building with sourcemaps you end up with an array of files as chunk.files. There is already a PR of someone pending for this issue. The code...

question

Support multiple html-webpack-plugin instances

[{"_id":"6347302fcd14df15ba5d9819","body":"Thanks for the valuable input, @jantimon. Still getting with hang of what are idiomatic best practices for Webpack plugins :)\r\n\r\nhttps:\/\/github.com\/jantimon\/resource-hints-webpack-plugin\/blob\/master\/index.js#L87-L89 feels a lot cleaner than the approach we're currently using here. I'm in favor of switching to it. \r\n\r\nhttps:\/\/github.com\/jantimon\/resource-hints-webpack-plugin\/blob\/master\/index.js#L55 appears to be where you're merging html-webpack-plugin's options with custom ones. I see no reason not to switch over to doing something similar there. I hadn't considered the multiple instance usecase but appreciate the tips!\r\n ","issue_id":1660458738777,"origin_id":277561925,"user_origin_id":110953,"create_time":1486340055,"update_time":1486340055,"id":1665609775727,"updated_at":"2022-10-12T21:22:55.726000Z","created_at":"2022-10-12T21:22:55.726000Z"},{"_id":"6347302fcd14df15ba5d981a","body":"@addyosmani cool \ud83d\udc4d for the html-webpack-plugin 3 version there will be an api to create custom tag elements: \r\n\r\nhttps:\/\/github.com\/jantimon\/html-webpack-plugin\/blob\/version-3.x\/lib\/html-tags.js#L28\r\n\r\nMaybe we will also backport it to the 2.x branch\r\n\r\nI am always happy for feedback from plugin authors on the events and options - so if something feels to complicated please let me know","issue_id":1660458738777,"origin_id":277608524,"user_origin_id":4113649,"create_time":1486367916,"update_time":1486368006,"id":1665609775730,"updated_at":"2022-10-12T21:22:55.730000Z","created_at":"2022-10-12T21:22:55.730000Z"},{"_id":"6347302fcd14df15ba5d981b","body":"@addyosmani We can actually keep the current API as the default options for every hmtl-webpack-plugin instance, and each instance can override them if required. One thing to consider moving options into html-webpack-plugin is naming conflicts with other plugins.","issue_id":1660458738777,"origin_id":278000478,"user_origin_id":551595,"create_time":1486474383,"update_time":1486474383,"id":1665609775734,"updated_at":"2022-10-12T21:22:55.734000Z","created_at":"2022-10-12T21:22:55.734000Z"},{"_id":"6347302fcd14df15ba5d981c","body":"@bekos \r\n\r\n> We can actually keep the current API as the default options for every hmtl-webpack-plugin instance, and each instance can override them if required.\r\n\r\nThat sounds pretty reasonable to me as well. \r\n\r\n> cool \ud83d\udc4d for the html-webpack-plugin 3 version there will be an api to create custom tag elements:\r\n\r\n@jantimon Oh that's totally rad. Thanks for sharing that insight. I'd be interested in it being backported, but don't want to add too much to your workload - is V3's api surface vastly different?","issue_id":1660458738777,"origin_id":284287117,"user_origin_id":110953,"create_time":1488766895,"update_time":1488766895,"id":1665609775737,"updated_at":"2022-10-12T21:22:55.737000Z","created_at":"2022-10-12T21:22:55.737000Z"},{"_id":"6347302fcd14df15ba5d981d","body":"The tag structure is compatible with the current html-webpack-plugin version. The main idea behind 3.x is to get closer to the webpack 2.x internals and that causes some breaking changes but we try to introduce as few api changes as possible. Your plugin shouldn't be affected at all.","issue_id":1660458738777,"origin_id":284324339,"user_origin_id":4113649,"create_time":1488786360,"update_time":1488786360,"id":1665609775740,"updated_at":"2022-10-12T21:22:55.739000Z","created_at":"2022-10-12T21:22:55.739000Z"}] comment

I wrote most of the html-webpack-plugin code and would ask you to adapt your plugin a little bit. Instead of string search and replace you might want to alter the...

enhancement
help wanted

Filtering chunks

[{"_id":"6347351a6a9f94608c59fbbc","body":"I think that's a valid ask. You're proposing using a similar API to how html-webpack-plugin tackles this I assume? :)","issue_id":1660458738780,"origin_id":276835637,"user_origin_id":110953,"create_time":1485997824,"update_time":1485997824,"id":1665611034409,"updated_at":"2022-10-12T21:43:54.409000Z","created_at":"2022-10-12T21:43:54.409000Z"},{"_id":"6347351a6a9f94608c59fbbd","body":"Yeah that's correct. I just want to include\/exclude some **named chunks** on preload-webpack-plugin like html-webpack-plugin :)\r\n\r\nFYI, previously i was used below snippet (quick & dirty solution) for implementing preload chunks with filtering on my html-webpack-plugin html template file:\r\n\r\n```html\r\n <%\r\n Object.keys(webpack.assetsByChunkName)\r\n .filter((k) => k && k.indexOf('CHUNK_NAME_TO_BE_IGNORED') === -1)\r\n .reduce((collection, k) => collection.concat(webpack.assetsByChunkName[k]), [])\r\n .filter((filename) => filename && filename.slice(-3) === '.js')\r\n .forEach((filename) => {\r\n %>\r\n <link rel=\"preload\" href=\"<%= webpackConfig.output.publicPath %><%= filename %>\" as=\"script\">\r\n <% }); %>\r\n```\r\n\r\n","issue_id":1660458738780,"origin_id":276932914,"user_origin_id":2101743,"create_time":1486034820,"update_time":1486047845,"id":1665611034413,"updated_at":"2022-10-12T21:43:54.413000Z","created_at":"2022-10-12T21:43:54.413000Z"},{"_id":"6347351a6a9f94608c59fbbe","body":"The best way would be to use the chunks from `htmlPluginData` which gives you the setting for each generated page as you can use multiple html-webpack-plugin instances https:\/\/github.com\/GoogleChrome\/preload-webpack-plugin\/blob\/7760ef791605c05cd306c0f63ce9b6d6318a2c7c\/index.js#L36","issue_id":1660458738780,"origin_id":277073102,"user_origin_id":4113649,"create_time":1486067191,"update_time":1486073804,"id":1665611034417,"updated_at":"2022-10-12T21:43:54.417000Z","created_at":"2022-10-12T21:43:54.417000Z"},{"_id":"6347351a6a9f94608c59fbbf","body":"This option would be very useful! I wanted to exclude sourcemap's chunks but it seems not possible at the moment...","issue_id":1660458738780,"origin_id":277655959,"user_origin_id":879431,"create_time":1486380589,"update_time":1486380589,"id":1665611034422,"updated_at":"2022-10-12T21:43:54.422000Z","created_at":"2022-10-12T21:43:54.422000Z"},{"_id":"6347351a6a9f94608c59fbc0","body":"This would be useful for avoiding sourcemaps - maybe you could pass in a blacklist of regexes\/globs to match against? It could be populated with `['*.map']` for a start to stop the plugin including sourcemaps.","issue_id":1660458738780,"origin_id":278372424,"user_origin_id":193238,"create_time":1486570110,"update_time":1486570110,"id":1665611034427,"updated_at":"2022-10-12T21:43:54.426000Z","created_at":"2022-10-12T21:43:54.426000Z"},{"_id":"6347351a6a9f94608c59fbc1","body":"@addyosmani I'm happy to attempt a PR if you're happy with that approach, or to talk through it.","issue_id":1660458738780,"origin_id":278372497,"user_origin_id":193238,"create_time":1486570122,"update_time":1486570122,"id":1665611034430,"updated_at":"2022-10-12T21:43:54.429000Z","created_at":"2022-10-12T21:43:54.429000Z"},{"_id":"6347351a6a9f94608c59fbc2","body":"> This would be useful for avoiding sourcemaps - maybe you could pass in a blacklist of regexes\/globs to match against? It could be populated with ['*.map'] for a start to stop the plugin including sourcemaps.\r\n\r\nThis is useful. We don't want to preload sourcemap.","issue_id":1660458738780,"origin_id":279298694,"user_origin_id":1947344,"create_time":1486964343,"update_time":1486964343,"id":1665611034434,"updated_at":"2022-10-12T21:43:54.433000Z","created_at":"2022-10-12T21:43:54.433000Z"},{"_id":"6347351a6a9f94608c59fbc3","body":"I opened a PR with the blacklist feature: https:\/\/github.com\/GoogleChrome\/preload-webpack-plugin\/pull\/16\r\n\r\nIf anyone needs it for now you can always depend on my version of this repo.","issue_id":1660458738780,"origin_id":279334613,"user_origin_id":193238,"create_time":1486978101,"update_time":1486978101,"id":1665611034437,"updated_at":"2022-10-12T21:43:54.436000Z","created_at":"2022-10-12T21:43:54.436000Z"}] comment

It would be nice if preload-webpack-plugin supports filtering chunks (only include some chunks/exclude some chunks.) [like html-webpack-plugin's one](https://github.com/jantimon/html-webpack-plugin#filtering-chunks). It will be useful on some use-cases. 1. Some chunks (e.g. Admin...