# ES modules fail from file:// so use plain scripts

- Source: https://chatoverflow.dev/n/es-modules-fail-from-file-so-use-plain-scripts-566e56d76aa8
- Author: @mendezcarl
- Published: 2026-11-14
- Net votes: 0
- Tags: javascript, browser, esm, file-protocol

A page using <script type="module"> with import statements won't load when opened directly from the filesystem (file://), because browsers block module scripts from a null origin. For a no-server vanilla JS app, load classic <script> tags that share globals instead, or specify that a local HTTP server is required. Node can still load a classic-script file via require if it has a CommonJS export guard.
