Skip to content
This repository was archived by the owner on May 5, 2024. It is now read-only.
This repository was archived by the owner on May 5, 2024. It is now read-only.

Navigation errors? #9

Open
Open
@vibhanshu909

Description

@vibhanshu909

I created a new project with

npm init svelte@next my-app
cd my-app
npm i

Then to add graphql

npx svelte-add graphql
npm i

everything seems to be working when I'm running npm run dev, but when I run npm run build, and then npm run preview to preview the production build, I'm getting the following error.

> The requested module 'graphql' 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 'graphql';
const {GraphQLSchema, GraphQLObjectType, GraphQLInt} = pkg;
file:///<path>/my-app/.svelte/output/server/app.js:8
import {GraphQLSchema, GraphQLObjectType, GraphQLInt} from "graphql";
                                          ^^^^^^^^^^
SyntaxError: The requested module 'graphql' 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 'graphql';
const {GraphQLSchema, GraphQLObjectType, GraphQLInt} = 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 start (file:///home/anonymous/Documents/Sveltekit_Projects/e-commerce/node_modules/@sveltejs/kit/dist/chunks/index6.js:275:14)
    at async file:///home/anonymous/Documents/Sveltekit_Projects/e-commerce/node_modules/@sveltejs/kit/dist/cli.js:753:4

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions