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

(WIP) add importsNotUsedAsValues:error to tsconfig, fix resulting code errors #1501

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Jan 26, 2023

Summary

Solid leaves type imports behind, causing some systems to try to import non-existing things at runtime.

This relates to the node vs web structure. The app in question imports lume, which imports solid-js/html, etc, however does not use these APIs on the backend, only on the client.

The workaround for the app is to use await import('lume') in client-side code, so it is ignored in SvelteKit pre-rendering.

Here's a sample error:

file:///Users/trusktr/src/project/node_modules/.pnpm/solid-js@1.4.8/node_modules/solid-js/html/dist/html.js:1
import { effect, style, insert, spread, createComponent, delegateEvents, classList, mergeProps, dynamicProperty, setAttribute, setAttributeNS, addEventListener, Aliases, PropAliases, Properties, ChildProperties, DelegatedEvents, SVGElements, SVGNamespace } from 'solid-js/web';
                                                                                                                                                                 ^^^^^^^
SyntaxError: The requested module 'solid-js/web' does not provide an export named 'Aliases'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
SyntaxError: The requested module 'solid-js/web' does not provide an export named 'Aliases'
file:///Users/trusktr/src/project/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.438_svelte@3.55.1+vite@3.0.9/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:50
                                throw new Error(format_error(details, config));
                                      ^

Error: 500 /
    at file:///Users/trusktr/src/project/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.438_svelte@3.55.1+vite@3.0.9/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:50:11
    at save (file:///Users/trusktr/src/project/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.438_svelte@3.55.1+vite@3.0.9/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:339:4)
    at visit (file:///Users/trusktr/src/project/node_modules/.pnpm/@sveltejs+kit@1.0.0-next.438_svelte@3.55.1+vite@3.0.9/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:226:3)

How did you test this change?

Not done yet, need to test and update code

@changeset-bot
Copy link

changeset-bot bot commented Jan 26, 2023

⚠️ No Changeset found

Latest commit: 1409017

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coveralls
Copy link

Pull Request Test Coverage Report for Build 4019290439

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.233%

Totals Coverage Status
Change from base Build 4010986136: 0.0%
Covered Lines: 1292
Relevant Lines: 1389

💛 - Coveralls

@trusktr trusktr changed the title (WIP) add importsNotUsedAsValues:error to tsconfig (WIP) add importsNotUsedAsValues:error to tsconfig, fix resulting code errors Jan 26, 2023
@trusktr
Copy link
Contributor Author

trusktr commented Jan 26, 2023

Interesting, how can all tests have passed. Still need to update code.

@gxxcastillo
Copy link

I'm seeing this error when trying to import solid-js/html into my app, whether rendering on the server or on the client. I'm on solid-js v1.6.11

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

Successfully merging this pull request may close these issues.

3 participants