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

compile errors when typechecking svelte.config.js with moduleResolution set to nodenext #9663

Closed
DetachHead opened this issue Apr 14, 2023 · 6 comments
Milestone

Comments

@DetachHead
Copy link

DetachHead commented Apr 14, 2023

Describe the bug

when typechecking svelte.config.js with moduleResolution set to nodenext, the following compile errors occur:

❯ tsc svelte.config.js --allowjs --noemit --moduleresolution nodenext
node_modules/@sveltejs/kit/types/index.d.ts:6:32 - error TS2307: Cannot find module 'svelte/types/compiler/interfaces' or its corresponding type declarations.

6 import { CompileOptions } from 'svelte/types/compiler/interfaces';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@sveltejs/kit/types/internal.d.ts:408:15 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

408 export * from './index';
                  ~~~~~~~~~

node_modules/@sveltejs/kit/types/internal.d.ts:409:15 - error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

409 export * from './private';
                  ~~~~~~~~~~~

Reproduction

https://stackblitz.com/edit/sveltejs-kit-template-default-s2bims?file=package.json

Logs

No response

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm
  npmPackages:
    @sveltejs/adapter-auto: ^2.0.0 => 2.0.0 
    @sveltejs/kit: ^1.5.0 => 1.15.5 
    svelte: ^3.54.0 => 3.58.0 
    vite: ^4.2.0 => 4.2.1

Severity

serious, but I can work around it

Additional Information

other related issues:

@DetachHead DetachHead changed the title "Relative import paths need explicit file extensions" errors when typechecking svelte.config.js with moduleResolution set to nodenext compile errors when typechecking svelte.config.js with moduleResolution set to nodenext Apr 14, 2023
@dummdidumm
Copy link
Member

In Svelte 4 this will be exported from svelte/compiler, so once we bump the minimum required Svelte version we can fix this

@benmccann
Copy link
Member

I sent #11188 for SvelteKit

@sveltejs/enhanced-img uses a bunch of types that don't appear to be available in svelte/compiler, so maybe we need to export some more stuff for it?

@dummdidumm
Copy link
Member

Which ones are these?

@benmccann
Copy link
Member

import('svelte/types/compiler/interfaces').TemplateNode
import('svelte/types/compiler/interfaces').BaseDirective | import('svelte/types/compiler/interfaces').Attribute | import('svelte/types/compiler/interfaces').SpreadAttribute

@dummdidumm
Copy link
Member

Mhm I feel like those are somewhat private, we haven't made the AST public API until now, so I'd prefer if for now @sveltejs/static-image maintains their own versions of these.

@benmccann
Copy link
Member

Ok. I will close this as completed then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants