Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web-dev-server] Problems with Deno #2843

Open
stefanfrede opened this issue Nov 12, 2024 · 0 comments
Open

[web-dev-server] Problems with Deno #2843

stefanfrede opened this issue Nov 12, 2024 · 0 comments

Comments

@stefanfrede
Copy link

stefanfrede commented Nov 12, 2024

Hello,

I am trying to get WDS to work in a Deno 2 environment, but no luck so far.

This is my project structure:

.
├── deno.json
├── deno.lock
├── public
│   ├── index.html
│   ├── index.css
│   ├── index.js
│   └── …
└── …

And this is what I did:

I installed the server:

deno add --dev npm:@web/dev-server

Added some tasks to my deno.json file:

{
	"tasks": {
		"start": "deno run -A npm:@web/dev-server --root-dir public/ --node-resolve",
		"start:watch": "deno run -A npm:@web/dev-server --root-dir public/ --node-resolve --watch"
	},
	"nodeModulesDir": "auto",
	"imports": {
		"@web/dev-server": "npm:@web/dev-server@^0.4.6"
	}
}

And started the server:

deno task start:watch

Task start:watch deno run -A npm:@web/dev-server --root-dir public/ --watch
Web Dev Server started...

    Root dir: <project path>/public
    Local:    http://localhost:8000/
    Network:  http://100.85.0.1:8000/

When I now open http://localhost:8000/ in my browser I get a blank page and the following errors in my console:

The stylesheet http://localhost:8000/index.css was not loaded because its MIME type, “text/plain”, is not “text/css”.

Loading module from “http://localhost:8000/index.js” was blocked because of a disallowed MIME type (“text/plain”).

Loading module from “http://localhost:8000/__web-dev-server__web-socket.js” was blocked because of a disallowed MIME type (“text/plain”).

I can see that my `index.html' has been loaded, but I suspect that nothing is being displayed due to MIME type errors.

What am I missing?

Thanks in advance!

Maybe it helps to clarify things: https://codeberg.org/stefanfrede/frede-dev/src/branch/refactor/switch-to-wds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant