mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-30 06:08:12 +08:00
Hooks for sentry integration (#1460)
* add sentry webpack plugin * allow override of webpack config * work around cheerio inability to parse jinga templates * webpack can not minify jinja templates * allow script injection to specify other attributes * allow script injection to specify other attributes * Adjustments to make plugin systems work * Add sourcemaps for javascript in prod webpack * Update .gitignore * Fix spelling errors Co-authored-by: Matt Weiden <538456+mweiden@users.noreply.github.com>
This commit is contained in:
co-authored by
Matt Weiden
parent
9026e0ce41
commit
c1bf491a96
@@ -32,17 +32,15 @@ class CspHashPlugin {
|
||||
};
|
||||
}
|
||||
|
||||
// remove no-csp-hash attributes
|
||||
let foundOne = false;
|
||||
$("script[no-csp-hash]").each((i, elmt) => {
|
||||
$(elmt).removeAttr("no-csp-hash");
|
||||
foundOne = true;
|
||||
});
|
||||
$("style[no-csp-hash]").each((i, elmt) => {
|
||||
$(elmt).removeAttr("no-csp-hash");
|
||||
foundOne = true;
|
||||
});
|
||||
if (foundOne) data.html = $.html();
|
||||
// Remove no-csp-hash attributes. Cheerio does not parse Jinja templates
|
||||
// correctly, so we brute force this with a regular expression.
|
||||
data.html = data.html
|
||||
.replace(/(<script .*)no-csp-hash(.*>)/, (match, p1, p2) =>
|
||||
[p1, p2].join("")
|
||||
)
|
||||
.replace(/(<style .*)no-csp-hash(.*>)/, (match, p1, p2) =>
|
||||
[p1, p2].join("")
|
||||
);
|
||||
|
||||
// Tell webpack to move on
|
||||
cb(null, data);
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
const path = require("path");
|
||||
const HtmlWebpackPlugin = require("html-webpack-plugin");
|
||||
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
||||
const HtmlWebpackInlineSourcePlugin = require("html-webpack-inline-source-plugin");
|
||||
const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
|
||||
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
|
||||
const TerserJSPlugin = require("terser-webpack-plugin");
|
||||
@@ -38,6 +37,7 @@ module.exports = {
|
||||
}),
|
||||
],
|
||||
},
|
||||
devtool: "source-map",
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
@@ -87,18 +87,7 @@ module.exports = {
|
||||
filename: "index.html",
|
||||
template: path.resolve("index_template.html"),
|
||||
decodeEntities: false,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeRedundantAttributes: true,
|
||||
useShortDoctype: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeStyleLinkTypeAttributes: true,
|
||||
keepClosingSlash: true,
|
||||
minifyJS: true,
|
||||
minifyCSS: true,
|
||||
minifyURLs: true,
|
||||
},
|
||||
minify: false,
|
||||
}),
|
||||
new CleanWebpackPlugin({
|
||||
verbose: true,
|
||||
|
||||
Reference in New Issue
Block a user