solid icon indicating copy to clipboard operation
solid copied to clipboard

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

Open trusktr opened this issue 2 years ago • 4 comments

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/[email protected]/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/@[email protected][email protected][email protected]/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/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:50:11
    at save (file:///Users/trusktr/src/project/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/core/prerender/prerender.js:339:4)
    at visit (file:///Users/trusktr/src/project/node_modules/.pnpm/@[email protected][email protected][email protected]/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

trusktr avatar Jan 26 '23 21:01 trusktr

⚠️ No Changeset found

Latest commit: 14090172f4bc94d5c5dfa4b7ba658f4cd32f6d73

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

changeset-bot[bot] avatar Jan 26 '23 21:01 changeset-bot[bot]

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

coveralls avatar Jan 26 '23 21:01 coveralls

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

trusktr avatar Jan 26 '23 21:01 trusktr

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

gxxcastillo avatar Feb 28 '23 18:02 gxxcastillo