What’s so special about @web/dev-server
?
index.html :
<code><script type="module" src="dist/my-elements.js"></script>
</code>
<code><script type="module" src="dist/my-elements.js"></script>
</code>
<script type="module" src="dist/my-elements.js"></script>
dist/my-elements.js : (was compiled using tsc 5.5)
<code>import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
</code>
<code>import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
</code>
import { LitElement, html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
When I run npx web-dev-server --node-resolve --watch --open
http://localhost:8001/ shows the page without errors.
But if I run php -S localhost:8001
(or VSCode Live Server) and goto http://localhost:8001/ console shows :
<code>TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../".
</code>
<code>TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../".
</code>
TypeError: Failed to resolve module specifier "lit". Relative references must start with either "/", "./", or "../".
How does it resolve using @web/dev-server
?