Inspect the network requests and observe that the script is being loaded from the development server instead of the production server.
Expected Behavior
The data-ampdevmode attribute should only be used in development environments and not in production. A script hash should be used to verify that the custom script and included in a meta[name=amp-script-src] element in the document head.
Actual Behavior
The amp-script does not run in production because the data-ampdevmode attribute is present.
Proposed Fix
Remove the data-ampdevmode attribute from the <amp-script> component in production environment.
Description
The
data-ampdevmode
attribute is being used on an<amp-script>
tag in production code, which can lead to unintended behavior, such as:Steps to Reproduce
Publish the page and load it in a browser.
Inspect the network requests and observe that the script is being loaded from the development server instead of the production server.
Expected Behavior
The
data-ampdevmode
attribute should only be used in development environments and not in production. A script hash should be used to verify that the custom script and included in ameta[name=amp-script-src]
element in the document head.Actual Behavior
The amp-script does not run in production because the
data-ampdevmode
attribute is present.Proposed Fix
Remove the
data-ampdevmode
attribute from the<amp-script>
component in production environment.