research node active
00:00:00 ESC: back

Local Files, No CORS, No Build Tools (Neocities-Friendly)

Goal: split your app into files while keeping it runnable on local machine and uploadable to Neocities. This is the “compile once, run anywhere” lane.


The core rule

Browsers don’t execute JSX directly. If you split into .jsx and try to load it, you’ll get failures that look like CORS or “file cannot be found”. The fix: compile JSX to normal JS once.

Recommended folder layout

/app
  index.html
  /src
    app.jsx
    ui.jsx
    engine.jsx
  /dist
    app.js
    ui.js
    engine.js

Workflow (simple)

  • Edit JSX in /src
  • Compile to JS in /dist
  • Load only /dist/*.js from your HTML

Index load pattern (safe)

<!-- index.html -->
<script src="dist/ui.js"></script>
<script src="dist/engine.js"></script>
<script src="dist/app.js"></script>

If you still need a local server

Some APIs (fetching files, modules, audio) behave better over http than file://. Use a tiny local server when needed:

# Python (in your project folder)
python -m http.server 8000

# Then open:
http://localhost:8000/

Neocities deploy

  • Upload the same folder structure.
  • Make sure links are relative (no absolute disk paths).
  • Test after upload because caching can hide changes.

Win condition

You can now build multi-file apps without bundlers, and they work both locally and on Neocities. That’s “portable lab equipment”.