You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Notice how archive.org is inserting content into the file that wraps the entire file in a block:
The issue is that file is a standard es6 JS file and is using the import statement. All import statements in standard JS files need to be top-level, see the mdn documentation.
import declarations can only be present in modules, and only at the top-level (i.e. not inside blocks, functions, etc.).
The script inserted by archive.org moves the import from the top-level to the inside of a block by wrapping it in curly braces. This causes the JS file to fail to run with a SyntaxError.
The text was updated successfully, but these errors were encountered:
rajsite
changed the title
Injected script wrapper code breaks JS files
Injected script wrapper code breaks ES6 Module JS files
Dec 2, 2023
This not only impacts import statements, but also exports. I don't believe there's a workaround until wayback can handle type="module" on script tags, or use heuristics to detect if a .js file is using ES Module semantics.
See how the following page fails to render: https://web.archive.org/web/20231202192545/https://nimble.ni.dev/storybook/
The issue is that the page uses modern es6 modules in the js files. For example in:
https://web.archive.org/web/20231202192545/https://nimble.ni.dev/storybook/sb-manager/runtime.js
Notice how archive.org is inserting content into the file that wraps the entire file in a block:
The issue is that file is a standard es6 JS file and is using the
import
statement. Allimport
statements in standard JS files need to be top-level, see the mdn documentation.The script inserted by archive.org moves the
import
from the top-level to the inside of a block by wrapping it in curly braces. This causes the JS file to fail to run with aSyntaxError
.The text was updated successfully, but these errors were encountered: