Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with storeConfigInMeta=false #204

Closed
dwickern opened this issue Apr 29, 2021 · 2 comments · Fixed by #249
Closed

Build fails with storeConfigInMeta=false #204

dwickern opened this issue Apr 29, 2021 · 2 comments · Fixed by #249
Labels

Comments

@dwickern
Copy link

When setting storeConfigInMeta: false in ember-cli-build.js, this error occurs:

Build Error (ConfigReplace)

Run time configuration is required in order to determine if contentFor hook is run for but seems to be missing in existing content.
@jelhan jelhan added the bug label May 6, 2021
@jelhan
Copy link
Collaborator

jelhan commented May 6, 2021

Thanks a lot for reporting. I had a quick look into what might cause this bug.

The addon if contentFor hook is run for index.html or tests/index.html by parsing the run-time configuration: https://github.com/rwjblue/ember-cli-content-security-policy/blob/8f2bb08841c39973295d6129981f9fa07f3d8028/lib/utils.js#L179-L214 This logic relies on run-time configuration being stored in meta.

It is used to ensure that environment test is used for CSP configuration in tests/index.html regardless of the environment used for the rest of the build. https://github.com/rwjblue/ember-cli-content-security-policy/blob/9332dcc89db7c37ff4757d3187e5154b112283df/index.js#L209-L231

I'm not sure if there is any other way to distinguish if contentFor hook is executed for index.html or tests/index.html. Sadyl we can not rely on the hook's type because the hooks executed for index.html are a strict subset of the hooks executed for tests/index.html. And we need to inject code into both files.

@jelhan
Copy link
Collaborator

jelhan commented Oct 28, 2021

I have fixed this in #249. Actually I noticed that all the complexity around detecting if contentFor hook is run for index.html or tests/index.html is not needed (anymore). 🎉

The fix is included in v2.0.0-beta.5, which I released just now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants