Skip to content

Commit

Permalink
Create Plugin: Support SRI in dynamic imported chunks (#999)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackw authored Oct 4, 2024
1 parent 132f59e commit 7d77def
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import path from 'path';
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import { SubresourceIntegrityPlugin } from "webpack-subresource-integrity";
import { type Configuration, BannerPlugin } from 'webpack';
import LiveReloadPlugin from 'webpack-livereload-plugin';
import VirtualModulesPlugin from 'webpack-virtual-modules';
Expand Down Expand Up @@ -182,6 +183,7 @@ const config = async (env): Promise<Configuration> => {
path: path.resolve(process.cwd(), DIST_DIR),
publicPath: `public/plugins/${pluginJson.id}/`,
uniqueName: pluginJson.id,
crossOriginLoading: 'anonymous',
},

plugins: [
Expand Down Expand Up @@ -231,6 +233,9 @@ const config = async (env): Promise<Configuration> => {
],
},
]),
new SubresourceIntegrityPlugin({
hashFuncNames: ["sha256"],
}),
...(env.development ? [
new LiveReloadPlugin(),
new ForkTsCheckerWebpackPlugin({
Expand Down
1 change: 1 addition & 0 deletions packages/create-plugin/templates/common/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
"webpack-livereload-plugin": "^3.0.2",
"webpack-subresource-integrity": "^5.1.0",
"webpack-virtual-modules": "^0.6.2"
},
"engines": {
Expand Down

0 comments on commit 7d77def

Please sign in to comment.