ui: Use babel plugin to strip calls to runInDebug (#10237)

This commit is contained in:
John Cowen 2021-05-17 13:27:34 +01:00 committed by GitHub
parent ede14b7c54
commit d1bbe0895f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 5 deletions

View File

@ -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,

View File

@ -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",

View File

@ -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"