Comments (5)
I got it working by turning off injection and adding:
<% for (var chunk in htmlWebpackPlugin.files.chunks) { %>
<script src="<%= htmlWebpackPlugin.files.chunks[chunk].entry %>"
integrity = "<%= compilation.assets[chunk+"."+htmlWebpackPlugin.files.chunks[chunk].hash+".bundle.js"].integrity %>"></script>
<% } %>
To my html template. But its slightly hacky because I've hard coded the file structure of my bundle asset files names, so it won't work with other file patterns. I've filed an issue on html-webpack to see if we can get direct access to the file key here: jantimon/html-webpack-plugin#330
from webpack-subresource-integrity.
FYI, still working on this. html-webpack-plugin would rather a write a hook to modify the HTML after the fact. I'm open to that, but its a little downstream of where i would like to do it, so we're going back and forth.
from webpack-subresource-integrity.
Or with https://github.com/jaketrent/html-webpack-template?
from webpack-subresource-integrity.
Hi, currently there is no integration with these packages and since we're not using them, no plans to implement any at the moment.
It sounds like a good fit though so if you want to go ahead and build integration I'd be happy to merge. Perhaps using their event hooks?
from webpack-subresource-integrity.
Seems like it might be possible by tweaking their templates to pull the SRI info you're already creating? I may be working on this in a couple of weeks.
from webpack-subresource-integrity.
Related Issues (20)
- Subresource Integrity support for Module Federation plugin chunks HOT 14
- Interoperability with 'mini-css-extract-plugin' HOT 1
- Interoperability with resource hints HOT 3
- Upgraded from 1 -> 5 and now integrity value is not available in custom webpack plugin HOT 4
- Chunk with id `0` missing from `sriHashes` HOT 7
- Firefox integrity hash + csp issue HOT 6
- TypeError: Class extends value undefined is not a constructor or null HOT 6
- Empty cssIntegrity/jsIntegrity when setting realContentHash to true HOT 2
- ignore error in ModuleFederationPlugin HOT 1
- 处理ModuleFederation问题 HOT 1
- Feature request: supporting additional file types beyond CSS and JS HOT 2
- Build Fails With HtmlWebpackPlugin HOT 1
- TypeError: Class extends value undefined is not a constructor or null HOT 1
- use mini-css-extract-plugin,js css create same chunkId
- Can this be used in nextjs
- Build fails when resource name contains percent encoded character
- [Question] From non-web developer about bundle's SRI
- Missing hashes when using cache groups
- What is the proper set up with a childcompiler usecase HOT 1
- Unresolved integrity placeholders HOT 1
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 webpack-subresource-integrity.