Included vanilla javascript scripts are not executed in the global scope the way they are in a non-bundled, statically-served site.
No configuration.
Bundling a vanilla, static website.
A vanilla bundled website should behave the same before and after it's bundled.
var testVariable = 1000;
<head><html>
<script src="./includedScript.js" />
<script>
// Prints "1000" in static server
// Undefined variable error when bundled
console.log(testVariable);
</script>
</html><body>
</body></html>
Execute normal included script tags in the global scope instead of scoping them. Required or otherwise imported scripts can still be scoped accordingly.
Trying to bundle a static website for production and use older libraries that rely on global scope.
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.8.1
| Node | 8.6.0
| npm | 5.3.0
| Operating System | Windows 10
Will be fixed in #1456
I still occur this issue in version: 1.10.3
I was also seeing that this was an issue.
same problem here. Any fix?
I still occur this issue in version: 1.10.3
What my solution is :
add --no-minify in terminal command.
then my html works correctly .
I was also seeing that this was an issue.
What my solution is :
add --no-minify in terminal command.
then my html works correctly .
same problem here. Any fix?
What my solution is :
add --no-minify in terminal command.
then my html works correctly .
Most helpful comment
same problem here. Any fix?