failed to load config from vite.config.js error when starting dev server

This issue has been tracked since 2021-07-20.

Describe the bug

Failed to load config from vite.config.js error when starting dev server.
I did see #59 but an error persists.

Reproduction

npm init [email protected] vite-svelte-test --template svelte

cd vite-svelte-test
npm install
npm run dev

Logs

failed to load config from /Users/sfm17/software/personal/vite-svelte-test/vite.config.js
error when starting dev server:
file:///Users/sfm17/software/personal/vite-svelte-test/node_modules/@sveltejs/vite-plugin-svelte/dist/index.js:800
import { diff_match_patch, DIFF_DELETE, DIFF_INSERT } from "diff-match-patch";
                           ^^^^^^^^^^^
SyntaxError: The requested module 'diff-match-patch' 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 'diff-match-patch';
const { diff_match_patch, DIFF_DELETE, DIFF_INSERT } = 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 (/Users/sfm17/software/personal/vite-svelte-test/node_modules/vite/dist/node/chunks/dep-11db14da.js:75342:31)
    at async resolveConfig (/Users/sfm17/software/personal/vite-svelte-test/node_modules/vite/dist/node/chunks/dep-11db14da.js:74965:28)
    at async createServer (/Users/sfm17/software/personal/vite-svelte-test/node_modules/vite/dist/node/chunks/dep-11db14da.js:73483:20)
    at async CAC.<anonymous> (/Users/sfm17/software/personal/vite-svelte-test/node_modules/vite/dist/node/cli.js:13959:24)

System Info

System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
    Memory: 1.44 GB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.4.0 - /usr/local/bin/node
    npm: 6.14.4 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 91.1.26.74
    Chrome: 91.0.4472.164
    Firefox: 88.0.1
    Firefox Developer Edition: 91.0
    Safari: 14.1.1
  npmPackages:
    @sveltejs/vite-plugin-svelte: ^1.0.0-next.11 => 1.0.0-next.13
    svelte: ^3.37.0 => 3.38.3
    vite: ^2.4.2 => 2.4.2

Severity

blocking all usage of vite-plugin-svelte

dominikg wrote this answer on 2021-07-20

Can't reproduce with the steps provided.

I notice that you are using an outdated version of node 14 (14.4.0). Please update it and try again.
vite-plugin-svelte requires "node": "^12.20 || ^14.13.1 || >= 16"

If it still fails and you did any modification to the template after creating it, please provide a repository with them.

sophiamersmann wrote this answer on 2021-07-21

That was it! Thanks and sorry for the inconvience!

limbodan wrote this answer on 2022-03-12

how to check systeminfo on windows project,please

More Details About Repo
Owner Name sveltejs
Repo Name vite-plugin-svelte
Full Name sveltejs/vite-plugin-svelte
Language TypeScript
Created Date 2021-03-16
Updated Date 2022-11-29
Star Count 576
Watcher Count 15
Fork Count 54
Issue Count 12

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date