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

Error when loading with Svelte + SvelteKit + Vite #146

Open
MineYuanlu opened this issue Dec 26, 2024 · 0 comments
Open

Error when loading with Svelte + SvelteKit + Vite #146

MineYuanlu opened this issue Dec 26, 2024 · 0 comments

Comments

@MineYuanlu
Copy link

I am encountering issues when using codemirror-json-schema with a Svelte + SvelteKit + Vite setup. I’m seeing multiple errors during both SSR and CSR, and I’m not sure how to resolve them. Below are the versions of the relevant packages I am using:

  • @codemirror/commands: 6.7.1
  • @codemirror/lang-json: 6.0.1
  • @codemirror/language: 6.10.8
  • @codemirror/lint: 6.8.4
  • @codemirror/state: 6.5.0
  • @codemirror/theme-one-dark: 6.1.2
  • @codemirror/view: 6.36.1
  • codemirror: 6.0.1
  • codemirror-json-schema: 0.7.9
  • svelte-codemirror-editor: 1.4.1

Error stack:

16:36:29 [vite] Error when evaluating SSR module /src/lib/components/Schemas/InputJson.svelte: failed to import "codemirror-json-schema"
|- Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/foo/node_modules/codemirror-json-schema/dist/features/completion' imported from /foo/node_modules/codemirror-json-schema/dist/index.js
    at finalizeResolution (node:internal/modules/esm/resolve:265:11)
    at moduleResolve (node:internal/modules/esm/resolve:933:10)
    at defaultResolve (node:internal/modules/esm/resolve:1169:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:540:12)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:509:25)
    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:239:38)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:96:40)
    at link (node:internal/modules/esm/module_job:95:36)

Sourcemap for "/foo/node_modules/entities/lib/esm/index.js" points to missing source files
16:36:31 [vite] Failed to load source map for /foo/node_modules/ebnf/dist/Grammars/W3CEBNF.js.
Error: An error occurred while trying to read the map file at W3CEBNF.js.map
Error: ENOENT: no such file or directory, open '/foo/node_modules/ebnf/dist/Grammars/W3CEBNF.js.map'
    at async open (node:internal/fs/promises:639:25)
    at async Object.readFile (node:internal/fs/promises:1242:14)
    at async extractSourcemapFromFile (file:///foo/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:21001:53)
    at async loadAndTransform (file:///foo/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51892:27)
Sourcemap for "/foo/node_modules/entities/lib/esm/escape.js" points to missing source files
Sourcemap for "/foo/node_modules/entities/lib/esm/decode.js" points to missing source files
Sourcemap for "/foo/node_modules/entities/lib/esm/encode.js" points to missing source files
Sourcemap for "/foo/node_modules/entities/lib/esm/generated/encode-html.js" points to missing source files
Sourcemap for "/foo/node_modules/entities/lib/esm/generated/decode-data-xml.js" points to missing source files
Sourcemap for "/foo/node_modules/entities/lib/esm/generated/decode-data-html.js" points to missing source files
Sourcemap for "/foo/node_modules/entities/lib/esm/decode_codepoint.js" points to missing source files

Web:

app.js:61 SyntaxError: The requested module '/node_modules/deepmerge/dist/cjs.js?v=2f39708e' does not provide an export named 'default' (at merge.js?v=2f39708e:1:8)

vite.config.js:

	optimizeDeps: {
		exclude: [
			'@codemirror/commands',
			'@codemirror/lang-json',
			'@codemirror/language',
			'@codemirror/lint',
			'@codemirror/state',
			'@codemirror/theme-one-dark',
			'@codemirror/view',
			'codemirror',
			'codemirror-json-schema',
			'svelte-codemirror-editor',
		],
	},

Could anyone help me figure out what might be causing this and how to fix it?

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