Comments (8)
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.
This is useful. We don't want to preload sourcemap.
from preload-webpack-plugin.
I opened a PR with the blacklist feature: #16
If anyone needs it for now you can always depend on my version of this repo.
from preload-webpack-plugin.
I think that's a valid ask. You're proposing using a similar API to how html-webpack-plugin tackles this I assume? :)
from preload-webpack-plugin.
Yeah that's correct. I just want to include/exclude some named chunks on preload-webpack-plugin like html-webpack-plugin :)
FYI, previously i was used below snippet (quick & dirty solution) for implementing preload chunks with filtering on my html-webpack-plugin html template file:
<%
Object.keys(webpack.assetsByChunkName)
.filter((k) => k && k.indexOf('CHUNK_NAME_TO_BE_IGNORED') === -1)
.reduce((collection, k) => collection.concat(webpack.assetsByChunkName[k]), [])
.filter((filename) => filename && filename.slice(-3) === '.js')
.forEach((filename) => {
%>
<link rel="preload" href="<%= webpackConfig.output.publicPath %><%= filename %>" as="script">
<% }); %>
from preload-webpack-plugin.
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
from preload-webpack-plugin.
This option would be very useful! I wanted to exclude sourcemap's chunks but it seems not possible at the moment...
from preload-webpack-plugin.
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.
from preload-webpack-plugin.
@addyosmani I'm happy to attempt a PR if you're happy with that approach, or to talk through it.
from preload-webpack-plugin.
Related Issues (20)
- Can I use prealod webpack plugin with Webpack 3xx ?
- Expo for web compatibility
- Publish v3 to npm HOT 5
- Add links based on webpackPreload/webpackPrefetch magic comments HOT 1
- working
- ability to remove crossorigin
- crossorigin='crossorigin' issue on fonts
- how to make it do a link with prefetch assets in include is asyncChunk
- The stylesheet file and the preloaded styles are not in the correct order HOT 1
- 'html-webpack-plugin-before-html-processing'. Hook was not found. HOT 2
- Bug of fileBlacklist shadow merge
- How to use in MPA config to load async chunks?
- assets'path inject incorrent
- How to preload some of assets
- Webpack 5 Support? HOT 4
- Merge changes from tag 3.0.0-beta.4 HOT 2
- Use regex in 'include' option
- assets inject incorrent(produce three files for one file) HOT 1
- Support imagesrcset and imagesizes
- Feature to opt-in to CORS preload requests HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from preload-webpack-plugin.