diff --git a/ui/packages/consul-ui/ember-cli-build.js b/ui/packages/consul-ui/ember-cli-build.js index 638087bdf..1cbb99195 100644 --- a/ui/packages/consul-ui/ember-cli-build.js +++ b/ui/packages/consul-ui/ember-cli-build.js @@ -8,13 +8,19 @@ module.exports = function(defaults) { const env = EmberApp.env(); const prodlike = ['production', 'staging']; + const sourcemaps = !['production'].includes(env); const trees = {}; const addons = {}; const outputPaths = {}; let excludeFiles = []; - const sourcemaps = !['production'].includes(env); + const babel = { + plugins: [ + '@babel/plugin-proposal-object-rest-spread', + ], + sourceMaps: sourcemaps ? 'inline' : false, + } // setup up different build configuration depending on environment if(!['test'].includes(env)) { @@ -46,6 +52,13 @@ module.exports = function(defaults) { } } } + if(['production'].includes(env)) { + // everything apart from production is 'debug', including test + // which means this and everything it affects is never tested + babel.plugins.push( + ['strip-function-call', {'strip': ['Ember.runInDebug']}] + ) + } // trees.app = new Funnel('app', { @@ -69,10 +82,7 @@ module.exports = function(defaults) { 'ember-cli-math-helpers': { only: ['div'], }, - babel: { - plugins: ['@babel/plugin-proposal-object-rest-spread'], - sourceMaps: sourcemaps ? 'inline' : false, - }, + babel: babel, autoImport: { // allows use of a CSP without 'unsafe-eval' directive forbidEval: true, diff --git a/ui/packages/consul-ui/package.json b/ui/packages/consul-ui/package.json index 473a5c3ba..ad0264233 100644 --- a/ui/packages/consul-ui/package.json +++ b/ui/packages/consul-ui/package.json @@ -71,6 +71,7 @@ "babel-loader": "^8.1.0", "babel-plugin-ember-modules-api-polyfill": "^3.2.0", "babel-plugin-htmlbars-inline-precompile": "^5.0.0", + "babel-plugin-strip-function-call": "^1.0.2", "base64-js": "^1.3.0", "broccoli-asset-rev": "^3.0.0", "broccoli-funnel": "^3.0.3", diff --git a/ui/yarn.lock b/ui/yarn.lock index 825c3edaf..d06375df2 100644 --- a/ui/yarn.lock +++ b/ui/yarn.lock @@ -2746,6 +2746,11 @@ babel-plugin-polyfill-regenerator@^0.1.2: dependencies: "@babel/helper-define-polyfill-provider" "^0.1.5" +babel-plugin-strip-function-call@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/babel-plugin-strip-function-call/-/babel-plugin-strip-function-call-1.0.2.tgz#374a68b5648e16e2b6d1effd280c3abc88648e3a" + integrity sha1-N0potWSOFuK20e/9KAw6vIhkjjo= + babel-plugin-syntax-async-functions@^6.8.0: version "6.13.0" resolved "https://registry.yarnpkg.com/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz#cad9cad1191b5ad634bf30ae0872391e0647be95"