From 0b494fa908db87fde1e773370520506f43908f68 Mon Sep 17 00:00:00 2001 From: hensm Date: Fri, 12 Apr 2019 22:40:55 +0100 Subject: [PATCH] Remove source maps from production builds --- ext/bin/build.js | 2 +- ext/webpack.config.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/ext/bin/build.js b/ext/bin/build.js index 51e2d7d..2505a37 100644 --- a/ext/bin/build.js +++ b/ext/bin/build.js @@ -69,7 +69,7 @@ const webpackConfig = require(`${ROOT}/webpack.config.js`)({ // Add mode to config webpackConfig.mode = argv.mode; webpackConfig.devtool = argv.mode === "production" - ? "source-map" + ? "none" : "eval"; diff --git a/ext/webpack.config.js b/ext/webpack.config.js index 37a5f07..740f0c9 100755 --- a/ext/webpack.config.js +++ b/ext/webpack.config.js @@ -4,6 +4,12 @@ const path = require("path"); const webpack = require("webpack"); const CopyWebpackPlugin = require("copy-webpack-plugin"); + +const sourceFileExtensions = [ + ".js", ".jsx" + , ".ts", ".tsx" +]; + module.exports = (env) => ({ entry: { "main": `${env.includePath}/main.ts` @@ -41,8 +47,7 @@ module.exports = (env) => ({ { from: env.includePath , to: env.outputPath - , ignore: [ "*.js", "*.jsx" - , "*.ts", "*.tsx" ] + , ignore: sourceFileExtensions.map(ext => `*${ext}`) , transform (content, path) { // Access to variables in static files if (path.endsWith(".json")) { @@ -73,8 +78,7 @@ module.exports = (env) => ({ { test: /\.(js|ts)x?$/ , resolve: { - extensions: [ ".js", ".jsx" - , ".ts", ".tsx" ] + extensions: sourceFileExtensions } , include: env.includePath , use: {