-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Dev server fails to run on unmodified svelte-ts template #3834
Comments
please add |
Hi 👋 I implemented the fix in my own project and it still does not seem to work? failed to load config from B:\Github Desktop\Prisim\port-hole\vite.config.js
error when starting dev server:
file:///B:/Github%20Desktop/Prisim/port-hole/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:214
import { createMakeHot } from "svelte-hmr";
^^^^^^^^^^^^^
SyntaxError: The requested module 'svelte-hmr' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'svelte-hmr';
const { createMakeHot } = pkg;
at ModuleJob._instantiate (internal/modules/esm/module_job.js:97:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:135:5)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async loadConfigFromFile (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:70684:31)
at async resolveConfig (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:70307:28)
at async createServer (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:68853:20)
at async CAC.<anonymous> (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\cli.js:13892:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lukas\AppData\Roaming\npm-cache\_logs\2021-06-16T21_58_07_095Z-debug.log And after trying to patch much more it seems that I am absolutely not qualified to fix this on my own. > @0.0.0 dev B:\Github Desktop\Prisim\port-hole
> vite
failed to load config from B:\Github Desktop\Prisim\port-hole\vite.config.js
error when starting dev server:
file:///B:/Github%20Desktop/Prisim/port-hole/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:314
import { normalizePath } from "vite";
^^^^^^^^^^^^^
SyntaxError: The requested module 'vite' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'vite';
const { normalizePath } = pkg;
at ModuleJob._instantiate (internal/modules/esm/module_job.js:97:21)
at async ModuleJob.run (internal/modules/esm/module_job.js:135:5)
at async Loader.import (internal/modules/esm/loader.js:178:24)
at async loadConfigFromFile (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:70684:31)
at async resolveConfig (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:70307:28)
at async createServer (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:68853:20)
at async CAC.<anonymous> (B:\Github Desktop\Prisim\port-hole\node_modules\vite\dist\node\cli.js:13892:24)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @0.0.0 dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @0.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lukas\AppData\Roaming\npm-cache\_logs\2021-06-16T22_05_00_268Z-debug.log |
Related: sveltejs/vite-plugin-svelte#61 |
perhaps this should be optional or asked in prompt. As having |
see my response there, and also the discussions of this PR #3835 type: module is the default for svelte projects. You can remove it if you don't want to use it but i don't think this should be made optional. (Would require work on create-app and also on other templates) |
Thanks! |
This issue gets locked because it has been closed for more than 14 days. |
Describe the bug
The dev server fails to launch in a brand new Vite project (out of the box, no changes) when using the
svelte-ts
template.I've also tried
vanilla
andvanilla-ts
, and these work fine. Butsvelte-ts
doesn't work.Reproduction
Just run this:
For me, the
yarn dev
fails (see log output further down).System Info
Output of
npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:Used package manager: yarn
Logs
Before submitting the issue, please make sure you do the following
The text was updated successfully, but these errors were encountered: