Problem with a SPA and owc-dev-server (--app-index)
See original GitHub issueI’m having troubles using the default start
script in package.json
.
The default one is:
"start": "owc-dev-server --open ./src"
but I’m building a SPA (single page application) and I changed it to:
"start": "owc-dev-server --app-index ./src/index.html"
adding also in index.html
’s <head>
:
<base href="/">
But now the problem is:
<script type="module" src="./my-app.js"></script>
In browser’s console I got this error:
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
I need to change it like this to work:
<script type="module" src="./src/my-app.js"></script>
adding ./src
before /my-app.js
.
The problem now is using npm run build
: it doesn’t find my-app.js
during build.
I’m wrong somewhere, but where?
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes indeed, I fully agree. Ive fixed the scaffold to set it up correctly now!
Closing this as it’s fixed and we’re using es-dev-server now.