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

Svelte kit Adapter Issue #1799

Open
tiddle opened this issue Apr 30, 2023 · 1 comment
Open

Svelte kit Adapter Issue #1799

tiddle opened this issue Apr 30, 2023 · 1 comment

Comments

@tiddle
Copy link

tiddle commented Apr 30, 2023

This is the error i'm getting:

> Using @sveltejs/adapter-node
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/app-definition.js -> node_modules/contentful-management/dist/es-modules/create-app-definition-api.js -> node_modules/contentful-management
/dist/es-modules/entities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/app-definition.js -> node_modules/contentful-management/dist/es-modules/create-app-definition-api.js -> node_modules/contentful-management/dist/es-modules/entities/app-definition.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/entry.js -> node_modules/contentful-management/dist/es-modules/create-entry-api.js -> node_modules/contentful-management/dist/es-modules/e
ntities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/environment.js -> node_modules/contentful-management/dist/es-modules/create-environment-api.js -> node_modules/contentful-management/dist/
es-modules/entities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/environment.js -> node_modules/contentful-management/dist/es-modules/create-environment-api.js -> node_modules/contentful-management/dist/
es-modules/entities/ui-config.js -> node_modules/contentful-management/dist/es-modules/create-ui-config-api.js -> node_modules/contentful-management/dist/es-modules/entities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/environment.js -> node_modules/contentful-management/dist/es-modules/create-environment-api.js -> node_modules/contentful-management/dist/
es-modules/entities/user-ui-config.js -> node_modules/contentful-management/dist/es-modules/create-user-ui-config-api.js -> node_modules/contentful-management/dist/es-modules/entities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/environment-template.js -> node_modules/contentful-management/dist/es-modules/create-environment-template-api.js -> node_modules/contentfu
l-management/dist/es-modules/entities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/organization.js -> node_modules/contentful-management/dist/es-modules/create-organization-api.js -> node_modules/contentful-management/dis
t/es-modules/entities/index.js
Circular dependency: node_modules/contentful-management/dist/es-modules/entities/index.js -> node_modules/contentful-management/dist/es-modules/entities/space.js -> node_modules/contentful-management/dist/es-modules/create-space-api.js -> node_modules/contentful-management/dist/es-modules/e
ntities/index.js
error during build:
RollupError: "default" is not exported by "node_modules/contentful-management/dist/es-modules/contentful-management.js", imported by ".svelte-kit/adapter-node/entries/pages/sverdle/_page.server.ts.js".
    at error (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:2125:30)
    at Module.error (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:13438:16)
    at Module.traceVariable (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:13845:29)
    at ModuleScope.findVariable (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:12404:39)
    at ReturnValueScope.findVariable (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:6965:38)
    at ChildScope.findVariable (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:6965:38)
    at MemberExpression.bind (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:9317:49)
    at CallExpression.bind (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:5738:23)
    at CallExpression.bind (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:9668:15)
    at ExpressionStatement.bind (file:///home/carlo/workspace/test-app/node_modules/rollup/dist/es/shared/node-entry.js:5738:23)

This is from a fresh install of a TS version of a svelte kit with it's demo app.

Steps to reproduce:

  1. Install sveltekit with npm create svelte@latest my-app
  2. I don't think any of the options matter when creating the app, I just installed the demo app to make things easier
  3. install contentful-management and adapter via npm i -D contentful-management @sveltejs/adapter-node
  4. In svelte.config.js change '@sveltejs/adapter-auto'; to '@sveltejs/adapter-node';
  5. In a +page.server.[ts/js], doesn't matter which, add import contentful from 'contentful-management';
  6. In the same +page.server.[ts/js] the following code in a function or something, doesn't really matter where
const aa = contentful.createClient({
    accessToken: 'foo'
});
  1. Execute npm run build

It will seem like it's working until the > Using @sveltejs/adapter-node then the error occurs.

Note: I've also tried it with @sveltejs/adapter-deno and the same issue occurs.

How do i fix this?

@tiddle
Copy link
Author

tiddle commented May 4, 2023

Okie, so as a work around you can do the following:

import * as contentful from 'contentful-management';

then in your function you can do:

return contentful.default.createClient(
		{
			accessToken: 'foo'
		},

It still has the Circular Dependency warnings, but it does compile.

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