Ember prepends application name in the script tag in production environment

#1

I am trying to build my application in production environment, which seems fine. But as soon as I access the application, I get the following errors in the console:

Error parsing ‘integrity’ attribute. The specified hash algorithm must be one of ‘sha256’, ‘sha384’, or ‘sha512’.

The hash seems fine, the problem is that the integrity attributes is like:

<script src="appname/path/assets/filename.js" integrity="appname/path/sha256...."></script>

instead of:

<script src="appname/path/assets/filename.js" integrity="sha256...."></script>

I don’t really know why is it adding the name and the path in the first place, or where or how it’s configured.

I also added the type attribute, that also got prepended with appname/path

Can anyone please help me with the correct configuration for this?

#2

It sounds like some addon has a bug and is modifying more than it intended to.

What does that script tag look like in your app/index.html? Does it have integrity="" or something different?

Are you customizing any asset paths in the arguments to new EmberApp in ember-cli-build.js?

#3

The script tag in index.html looks like:

<script src="assets/filename.js"></script>

I am not putting the integrity attribute, it gets added when I build in production mode.

Not customizing any asset paths either.

Thanks.

#4

Hmm, I think this is worth filing a bug on https://github.com/ember-cli/ember-cli/issues

In the meantime you can disable this feature by removing ember-cli-sri from package.json.