Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'webpack-subresource-integrity' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
},
plugins: [
// Generating static HTML page for simple static deployment
// https://github.com/jantimon/html-webpack-plugin
isProduction && isClient ?
new HtmlWebpackPlugin({
template: HTML_TEMPLATE
}) :
null,
// Subresource Integrity (SRI) is a security feature that enables browsers to verify that
// files they fetch (for example, from a CDN) are delivered without unexpected manipulation.
// https://www.npmjs.com/package/webpack-subresource-integrity
// Browser-Support: http://caniuse.com/#feat=subresource-integrity
new SriPlugin({
hashFuncNames: [ "sha256", "sha512" ],
enabled: isProduction && isClient
}),
// Improve OS compatibility
// https://github.com/Urthen/case-sensitive-paths-webpack-plugin
new CaseSensitivePathsPlugin(),
// Custom progress plugin
new VerboseProgress(),
// Automatically assign quite useful and matching chunk names based on file names.
new ChunkNames(),
// We use this so that our generated [chunkhash]'s are only different if
// the content for our respective chunks have changed. This optimises
},
plugins: [
// Generating static HTML page for simple static deployment
// https://github.com/jantimon/html-webpack-plugin
isProduction && isClient ?
new HtmlWebpackPlugin({
template: path.resolve(__dirname, "../src/index.ejs")
}) :
null,
// Subresource Integrity (SRI) is a security feature that enables browsers to verify that
// files they fetch (for example, from a CDN) are delivered without unexpected manipulation.
// https://www.npmjs.com/package/webpack-subresource-integrity
// Browser-Support: http://caniuse.com/#feat=subresource-integrity
new SriPlugin({
hashFuncNames: [ "sha256", "sha512" ],
enabled: isProduction && isClient
}),
// Improve OS compatibility
// https://github.com/Urthen/case-sensitive-paths-webpack-plugin
new CaseSensitivePathsPlugin(),
// Custom progress plugin
new VerboseProgress(),
// Automatically assign quite useful and matching chunk names based on file names.
new ChunkNames(),
// We use this so that our generated [chunkhash]'s are only different if
// the content for our respective chunks have changed. This optimises
// Generating static HTML page for simple static deployment
// https://github.com/jantimon/html-webpack-plugin
/*
isProduction && isClient ?
new HtmlWebpackPlugin({
template: HTML_TEMPLATE
}) :
null,
*/
// Subresource Integrity (SRI) is a security feature that enables browsers to verify that
// files they fetch (for example, from a CDN) are delivered without unexpected manipulation.
// https://www.npmjs.com/package/webpack-subresource-integrity
// Browser-Support: http://caniuse.com/#feat=subresource-integrity
new SriPlugin({
hashFuncNames: [ "sha256", "sha512" ],
enabled: isProduction && isClient
}),
// Improve OS compatibility
// https://github.com/Urthen/case-sensitive-paths-webpack-plugin
new CaseSensitivePathsPlugin(),
// Custom progress plugin
process.stdout.isTTY ? new VerboseProgress({
prefix: PREFIX
}) : null,
// Analyse bundle in production
isClient && isProduction ? new BundleAnalyzerPlugin.BundleAnalyzerPlugin({
analyzerMode: "static",
function compile({ entry = {}, includeSriPlugin = true } = {}) {
const sriFile = path.join(distDir, 'sri.json');
const plugins = [];
if (includeSriPlugin) {
plugins.push(new SriPlugin({ hashFuncNames: ['sha512'] }));
}
plugins.push(new SriDataPlugin({ saveAs: sriFile }));
const compiler = webpack({
entry: {
app: path.join(srcDir, 'app'),
...entry,
},
output: {
crossOriginLoading: 'anonymous',
path: path.join(tempDir.name, 'dist'),
filename: '[name].js',
chunkFilename: '[name].js',
},
plugins,
});
static setSriPlugin() {
return new SriPlugin({
hashFuncNames: ['sha256', 'sha384']
});
}