Registry / devops / webpack-subresource-integrity-embroider

webpack-subresource-integrity-embroider

JSON →
library0.2.4jsnpmunverified

Webpack plugin providing Subresource Integrity (SRI) support for Ember applications built with Embroider. At version 0.2.4, this package addresses limitations of both ember-cli-sri (which does not support Embroider) and the generic webpack-subresource-integrity plugin (which cannot handle non-webpack-managed assets and the Embroider-generated index.html). It injects integrity attributes into link and script elements while handling edge cases like empty rootURL/publicPath, inline scripts, and external resources. Release cadence is sporadic with bug fixes and enhancements. Key differentiator: native Embroider integration without requiring additional addons.

npm install webpack-subresource-integrity-embroider
INSTALL
IMPORT
SIG · WEBPACK-SUBRESOURC
W
webpack-subresource-integrity-embroider
devopsjavascriptv0.2.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SubresourceIntegrityPlugin
const SubresourceIntegrityPlugin = require('webpack-subresource-integrity-embroider');
import SubresourceIntegrityPlugin from 'webpack-subresource-integrity-embroider';
Package does not ship ESM; use CommonJS require. Type definitions only exist via @types/webpack.
default
const SubresourceIntegrityPlugin = require('webpack-subresource-integrity-embroider').default;
const SubresourceIntegrityPlugin = require('webpack-subresource-integrity-embroider');
The default export is the plugin class itself; both patterns work but the second is more common. The package does not export named exports.
PluginOptions
No TypeScript types exported; use inline type or ignore.
import { PluginOptions } from 'webpack-subresource-integrity-embroider';
Package does not export TypeScript types. Options should be typed manually if using TypeScript.

Adds the webpack-subresource-integrity-embroider plugin to an Embroider-based Ember app's webpack config in ember-cli-build.js.

const EmberApp = require('ember-cli/lib/broccoli/ember-app'); const SubresourceIntegrityPlugin = require('webpack-subresource-integrity-embroider'); module.exports = function (defaults) { const app = new EmberApp(defaults, {}); const { maybeEmbroider } = require('@embroider/test-setup'); return maybeEmbroider(app, { packagerOptions: { webpackConfig: { plugins: [new SubresourceIntegrityPlugin()], }, }, }); };
Debug
Known issues
breakingPackage is not compatible with Ember apps not using Embroider; will not add integrity attributes.
fix
Use ember-cli-sri instead for classic Ember builds.
affects: >=0.0.0
gotchaExternal resources (e.g., CDN scripts) without integrity hashes cause build errors since v0.2.0.
fix
Either provide integrity hashes for all external resources or disable the check by setting `hashExternal: false` in plugin options (if supported). Check documentation for options.
affects: >=0.2.0
deprecatedUsing `require('webpack-subresource-integrity-embroider')` returns the constructor directly; no `.default` needed.
fix
Use `const SubresourceIntegrityPlugin = require('webpack-subresource-integrity-embroider');`
affects: >=0.1.0
gotchaEmpty rootURL or publicPath caused issues in versions below 0.2.4; assets might not get integrity attributes.
fix
Upgrade to >=0.2.4.
affects: <0.2.4
gotchaInline scripts are not supported before v0.2.2; plugin would fail.
fix
Upgrade to >=0.2.2 or avoid inline scripts.
affects: <0.2.2
Errors
Common errors & fixes
Cannot find module 'webpack-subresource-integrity-embroider'
Package not installed or incorrect require path.
fix
Run `npm install webpack-subresource-integrity-embroider --save-dev` and ensure require path matches.
Error: Invalid encoding of hash in integrity value
Bug in versions <0.1.2 causing invalid base64 encoding.
fix
Upgrade to >=0.1.2.
TypeError: Cannot read property 'tapAsync' of undefined
Plugin expects webpack compiler; incorrect usage or missing webpack dependency.
fix
Ensure webpack is installed as a peer dependency and the plugin is added to webpack config correctly.
Build error: External resource https://example.com/script.js does not have integrity hash
Plugin enforces integrity hashes for external resources since v0.2.0.
fix
Add integrity attribute to the resource or set `hashExternal: false` in plugin options (if available).
Upgrade
Version history
0.2.4latest on npm
Audit
Dependencies
webpackrequiredPeer dependency; plugin integrates with Webpack's compilation hooks.
Agent activity
22 hits · last 30 days
node
18
OpenAI (training)
2
Resources
webpack-subresource-integrity-embroider — npm install webpack-subresource-integrity-embroider · libregistry