@apollo/client using svelte "Named export 'remove' not found."

Viewed 214

Like this problem, same error is occurring while using svelte kit.

here is the error:

import { remove } from "ts-invariant/process/index.js";
         ^^^^^^
SyntaxError: Named export 'remove' not found. The requested module 'ts-invariant/process/index.js' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'ts-invariant/process/index.js';
const { remove } = pkg;

I'm using the current version(^3.5.10) of @apollo/client, and using the beta version(^3.6.0-beta.6) gets other error; while using import { ApolloClient, InMemoryCache, gql } from '@apollo/client/core/index.js', it gets:

Directory import '/node_modules/@apollo/client/core' is not supported resolving ES modules imported from /node_modules/svelte-apollo/dist/svelte-apollo.js

or if I use import { ApolloClient, InMemoryCache, gql } from '@apollo/client/core', it gets:

Directory import 'node_modules/@apollo/client/core' is not supported resolving ES modules imported from node_modules/svelte-apollo/dist/svelte-apollo.js
Did you mean to import @apollo/client/core/core.cjs?

or if I use import { ApolloClient, InMemoryCache, gql } from '@apollo/client/core/core.cjs' it just says

exports is not defined
0 Answers
Related