fix: customize eai publicAssetURL in production

The `lib/startup`-addon is used to create a custom
index.html page to boot up the app. Because this is
a custom approach and we aren't relying on setting
rootURL to a different value when running the app
in `production` we need to set `publicAssetURL`
in the configuration we pass to `ember-auto-import`.

Reference:
9a2887f1d0/docs/upgrade-guide-2.0.md (quick-summary)
This commit is contained in:
Michael Klein 2022-10-24 14:28:58 +02:00
parent 7d3186d7c5
commit 7636d191b1
1 changed files with 2 additions and 0 deletions

View File

@ -17,6 +17,7 @@ module.exports = function (defaults, $ = process.env) {
$ = utils.env($); $ = utils.env($);
const env = EmberApp.env(); const env = EmberApp.env();
const isProd = ['production'].includes(env);
const prodlike = ['production', 'staging']; const prodlike = ['production', 'staging'];
const devlike = ['development', 'staging']; const devlike = ['development', 'staging'];
const sourcemaps = !['production'].includes(env) && !$('BABEL_DISABLE_SOURCEMAPS', false); const sourcemaps = !['production'].includes(env) && !$('BABEL_DISABLE_SOURCEMAPS', false);
@ -197,6 +198,7 @@ module.exports = function (defaults, $ = process.env) {
autoImport: { autoImport: {
// allows use of a CSP without 'unsafe-eval' directive // allows use of a CSP without 'unsafe-eval' directive
forbidEval: true, forbidEval: true,
publicAssetURL: isProd ? '{{.ContentPath}}assets' : undefined,
}, },
codemirror: { codemirror: {
keyMaps: ['sublime'], keyMaps: ['sublime'],