Dealing with changes to script tags

Hello! I really love Netlify so far! It’s been a pleasure to use, but there’s an issue I don’t know how to get around.

I’ve been loading a javascript package from an external CDN, and I want to make it part of my project instead of relying on an external source. The package has a configuration parameter that’s appended to the package location in a script tag. It looks like this:

<script src=""></script>

I added a local copy of the package and tested it locally. Everything seemed fine, so I pushed the changes, but the live site was broken. Netlify had changed the script tag to this:

<script src=""></script>

The configuration parameter had been removed. Is there any way to keep netlify from removing that during the build?

Hi, @carpequeso! Great question and interesting issue. First, Netlify should normally never modify your files … unless you have enabled our asset optimization as part of post processing.

Would you please try disabling asset optimization to see if this resolves the issue?

You can find that in the deploy settings for the site Site > Settings > Build & deploy, then scroll down to the “Post processing” section.

1 Like

Ah, good call @luke. The javascript bundling feature seems to be the problem, but in more ways than just that. It does remove the configuration parameter, but it also changes the locations of a few of the javascript files in the package, which led to some extra 404s when the file loaded from that script tag started to request other files.

With that disabled, everything is working as expected. Thanks for the help!