Fix CSP issues in production

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-01-26 16:39:50 +01:00
parent c596d7e478
commit e933004daf
4 changed files with 14 additions and 14 deletions

View File

@@ -1,10 +1,8 @@
const path = require("path");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const webpack = require("webpack");
module.exports = {
runtimeCompiler: true,
filenameHashing: true,
productionSourceMap: false,
outputDir: path.resolve(__dirname, "../priv/static"),
configureWebpack: (config) => {
// Limit the used memory when building
@@ -26,6 +24,12 @@ module.exports = {
forkTsCheckerOptions.memoryLimit = process.env.NODE_BUILD_MEMORY || 2048;
config.plugins.push(new ForkTsCheckerWebpackPlugin(forkTsCheckerOptions));
config.plugins.push(
new webpack.DefinePlugin({
global: "window", // Placeholder for global used in any node_modules
})
);
config.node.global = false;
},
chainWebpack: (config) => {
// remove the prefetch plugin