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

Package now compiles Typescript files to CJS instead of ESM #4764

Closed
jacob-8 opened this issue Apr 28, 2022 · 6 comments
Closed

Package now compiles Typescript files to CJS instead of ESM #4764

jacob-8 opened this issue Apr 28, 2022 · 6 comments
Labels
pkg:svelte-package Issues related to svelte-package

Comments

@jacob-8
Copy link
Contributor

jacob-8 commented Apr 28, 2022

Describe the bug

Upgrading from @sveltejs/kit@1.0.0-next.314 to @sveltejs/kit@1.0.0-next.315 will change the output of svelte-kit package as follows:

image

image

My package is now broken when trying to install in another app (ReferenceError: exports is not defined in reference to an action defined in a .js file) if I upgrade SvelteKit and I'm forced to stay .314.

Reproduction

Logs

No response

System Info

System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
    Memory: 1.14 GB / 11.77 GB
  Binaries:
    Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.4 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.22000.120.0), Chromium (100.0.1185.50)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    @sveltejs/adapter-auto: 1.0.0-next.40 => 1.0.0-next.40
    @sveltejs/kit: 1.0.0-next.314 => 1.0.0-next.315
    @sveltejs/vite-plugin-svelte: ^1.0.0-next.41 => 1.0.0-next.41
    svelte: ^3.47.0 => 3.47.0

Severity

blocking an upgrade

Additional Information

No response

@elliott-with-the-longest-name-on-github
Copy link
Contributor

Weird... I just checked the changelog for 314 => 315, and this is the only line I could possibly see that might cause this issue, but it shouldn't be the problem. I'll try to look further into this when I get home to at least triage.

@dummdidumm
Copy link
Member

Possibly related #4460

@dummdidumm dummdidumm added bug Something isn't working pkg:svelte-package Issues related to svelte-package labels Apr 28, 2022
@gtm-nayan
Copy link
Contributor

This commit seems like the culprit, changelog didn't pick up on it 2bb2ab0

@dummdidumm dummdidumm removed the bug Something isn't working label Apr 28, 2022
@gtm-nayan
Copy link
Contributor

Oh, it's a create-svelte change, that's why

@dummdidumm
Copy link
Member

dummdidumm commented Apr 28, 2022

Thanks @gtm-nayan that might be indeed the culprit. If you set target and lib to what was generated before, does the error go away?

		"lib": ["es2020", "DOM"],
		"moduleResolution": "node",
		"module": "es2020",
		"resolveJsonModule": true,
		"skipLibCheck": true,
		"sourceMap": true,
		"strict": true,
		"target": "es2020"

@jacob-8
Copy link
Contributor Author

jacob-8 commented Apr 28, 2022

Thank you, all! I created a new svelte-kit app and copied in the default compilerOptions from the j/tsconfig.json file and all is working as expected using this tsconfig:

image

I know it's not 1.0, but it'd be nice for that to be documented somewhere as breaking change. I had already scoured the docs and changelogs ahead of posting my bug but it wasn't there of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:svelte-package Issues related to svelte-package
Projects
None yet
Development

No branches or pull requests

4 participants