Closed danieltroger closed 1 year ago
I can't even work around this by lazily importing the module and only importing it on the client :(
FYI these were the patches I had to do just to get the server to build. When trying to render suid stuff on the server there are loads of more errors where vite or whatever doesn't find the files that end with .jsx.
Could you test it again with the latest version?
Now it just says:
"SVGElements" is not exported by "node_modules/.pnpm/solid-js@1.7.3/node_modules/solid-js/web/dist/server.js", imported by ".solid/server/entry-server.js".
"getNextElement" is not exported by "node_modules/.pnpm/solid-js@1.7.3/node_modules/solid-js/web/dist/server.js", imported by ".solid/server/entry-server.js".
When building but it seems to work. Good stuff, what did you change?
The issue come from https://github.com/swordev/suid/issues/190 and it was patched here.
A official solution is incoming (https://github.com/solidjs/solid/pull/1635).
Cool! Then we can close this issue, right?
My latest patch (fixes the SVGElements
/ getNextElement
not exported issue):
diff --git a/node_modules/@suid/system/Dynamic/Dynamic.jsx b/node_modules/@suid/system/Dynamic/Dynamic.jsx
index a4e0932..f4c0256 100644
--- a/node_modules/@suid/system/Dynamic/Dynamic.jsx
+++ b/node_modules/@suid/system/Dynamic/Dynamic.jsx
@@ -1,7 +1,6 @@
/* eslint-disable no-constant-condition */
/* eslint-disable no-case-declarations */
import { $DEVCOMP, createMemo, splitProps, sharedConfig, untrack, } from "solid-js";
-import { isServer, spread, ssrElement } from "solid-js/web";
import * as web from "solid-js/web";
function createElement(tagName, isSVG = false) {
return isSVG
@@ -15,7 +14,7 @@ function createServerDynamicComponent(component, props) {
if (t === "function")
return comp(props);
else if (t === "string") {
- return ssrElement(comp, props, undefined, true);
+ return web.ssrElement(comp, props, undefined, true);
}
}
}
@@ -26,16 +25,17 @@ export function createStaticComponent(component, props) {
Object.assign(component, { [$DEVCOMP]: true });
return untrack(() => component(props));
case "string":
- const isSvg = web.SVGElements.has(component);
+ const { spread, SVGElements, getNextElement } = web;
+ const isSvg = SVGElements.has(component);
const el = sharedConfig.context
- ? web.getNextElement()
+ ? getNextElement()
: createElement(component, isSvg);
spread(el, props, isSvg);
return el;
}
}
export function createDynamicComponent(component, props) {
- if (isServer)
+ if (web.isServer)
return createServerDynamicComponent(component, props);
const cached = createMemo(component);
return createMemo(() => createStaticComponent(cached(), props));
@@ -43,7 +43,7 @@ export function createDynamicComponent(component, props) {
// https://github.com/solidjs/solid/blob/12c0dbbbf9f9fdf798c6682e57aee8ea763cf1ba/packages/solid/web/src/index.ts#L114
export function Dynamic(props) {
const [p, others] = splitProps(props, ["$component"]);
- if (isServer)
+ if (web.isServer)
return createServerDynamicComponent(() => p.$component, others);
return createDynamicComponent(() => p.$component, others);
}
I'm getting this error when trying to build:
Click to expand
``` daniel@mmmmmmmmmm my-app % pnpm build > my-app@ build /private/tmp/test/my-app > solid-start build solid-start build version 0.2.24 adapter node solid-start building client... vite v4.2.1 building for production... ✓ 564 modules transformed. Inspect report generated at /private/tmp/test/my-app/.solid/inspect dist/public/manifest.json 0.95 kB dist/public/ssr-manifest.json 57.84 kB dist/public/assets/index-fdb6b3cf.css 0.31 kB │ gzip: 0.22 kB dist/public/assets/entry-client-d870915a.css 0.38 kB │ gzip: 0.27 kB dist/public/assets/_...404_-4b8cacde.js 0.55 kB │ gzip: 0.37 kB dist/public/assets/entry-client-c8592954.js 40.58 kB │ gzip: 15.75 kB dist/public/assets/index-ff94255e.js 252.22 kB │ gzip: 65.57 kB ✓ built in 3.04s solid-start client built in: 3.060s solid-start building server... vite v4.2.1 building SSR bundle for production... ✓ 564 modules transformed. Inspect report generated at /private/tmp/test/my-app/.solid/inspect .solid/server/manifest.json 0.18 kB .solid/server/entry-server.js 573.55 kB ✓ built in 1.64s solid-start server built in: 1.657s file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:2128 base = Object.assign(new Error(base.message), base); ^ Error [RollupError]: "SVGElements" is not exported by "node_modules/.pnpm/solid-js@1.7.2/node_modules/solid-js/web/dist/server.js", imported by ".solid/server/entry-server.js". at error (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:2128:30) at Module.error (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:13322:16) at Module.traceVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:13707:29) at ModuleScope.findVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:12210:39) at FunctionScope.findVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:6953:38) at ChildScope.findVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:6953:38) at ReturnValueScope.findVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:6953:38) at ChildScope.findVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:6953:38) at BlockScope.findVariable (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:6953:38) at MemberExpression.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:9276:49) at CallExpression.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5749:23) at CallExpression.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:9630:15) at VariableDeclarator.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5749:23) at VariableDeclaration.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at SwitchCase.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at SwitchStatement.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at BlockStatement.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at ArrowFunctionExpression.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5749:23) at CallExpression.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at CallExpression.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:9630:15) at ReturnStatement.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5749:23) at BlockStatement.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at FunctionDeclaration.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5749:23) at Program.bind (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:5745:28) at Module.bindReferences (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:13318:18) at Graph.sortModules (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:24704:20) at Graph.build (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:24588:14) at async file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:25605:13 at async catchUnfinishedHookActions (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:24758:20) at async rollupInternal (file:///private/tmp/test/my-app/node_modules/.pnpm/rollup@3.20.2/node_modules/rollup/dist/es/shared/node-entry.js:25600:5) at async Object.build (file:///private/tmp/test/my-app/node_modules/.pnpm/solid-start-node@0.2.24_e3jdctozwqr272oblu5r5mgpw4/node_modules/solid-start-node/index.js:38:22) { binding: 'SVGElements', code: 'MISSING_EXPORT', exporter: '/private/tmp/test/my-app/node_modules/.pnpm/solid-js@1.7.2/node_modules/solid-js/web/dist/server.js', id: '/private/tmp/test/my-app/.solid/server/entry-server.js', url: 'https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module', pos: 227, loc: { column: 227, file: '/private/tmp/test/my-app/.solid/server/entry-server.js', line: 1 }, frame: '1: import { isServer, delegateEvents, createComponent as createComponent$1, ssrElement, mergeProps as mergeProps$1, renderToStringAsync, spread, escape, ssr, ssrHydrationKey, useAssets, ssrAttribute, HydrationScript, NoHydration, SVGElement...\n' + ' ^\n' + '2: import { createSignal, onCleanup, getOwner, runWithOwner, createMemo, createContext, useContext, createRenderEffect, untrack, createComponent, on, startTransition, resetErrorBoundaries, children, createRoot, Show, mergeProps, splitProps,...\n' + "3: import { createMutable, createStore } from 'solid-js/store';", watchFiles: [ '/private/tmp/test/my-app/.solid/server/server.js', '/private/tmp/test/my-app/.solid/server/entry-server.js', '/private/tmp/test/my-app/dist/public/route-manifest.json', '/private/tmp/test/my-app/node_modules/.pnpm/solid-start@0.2.24_l6z67so5xucnn4auv372wo6zfq/node_modules/solid-start/node/globals.js', '/private/tmp/test/my-app/node_modules/.pnpm/solid-start-node@0.2.24_e3jdctozwqr272oblu5r5mgpw4/node_modules/solid-start-node/server.js', '/private/tmp/test/my-app/node_modules/.pnpm/solid-js@1.7.2/node_modules/solid-js/dist/server.js', '/private/tmp/test/my-app/node_modules/.pnpm/solid-js@1.7.2/node_modules/solid-js/web/dist/server.js', '/private/tmp/test/my-app/node_modules/.pnpm/solid-js@1.7.2/node_modules/solid-js/store/dist/server.js', '/private/tmp/test/my-app/node_modules/.pnpm/solid-start@0.2.24_l6z67so5xucnn4auv372wo6zfq/node_modules/solid-start/node/fetch.js', '/private/tmp/test/my-app/node_modules/.pnpm/polka@1.0.0-next.22/node_modules/polka/build.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/sirv@2.0.2/node_modules/sirv/build.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/compression@1.7.4/node_modules/compression/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/seroval@0.5.1/node_modules/seroval/dist/esm/production/index.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/@polka+url@1.0.0-next.21/node_modules/@polka/url/build.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/trouter@3.2.1/node_modules/trouter/index.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/mrmime@1.0.1/node_modules/mrmime/index.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/totalist@3.0.1/node_modules/totalist/sync/index.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/parse-multipart-data@1.5.0/node_modules/parse-multipart-data/dist/multipart.js', '/private/tmp/test/my-app/node_modules/.pnpm/set-cookie-parser@2.6.0/node_modules/set-cookie-parser/lib/set-cookie.js', '\x00/private/tmp/test/my-app/node_modules/.pnpm/parse-multipart-data@1.5.0/node_modules/parse-multipart-data/dist/multipart.js?commonjs-es-import', '\x00commonjsHelpers.js', '\x00/private/tmp/test/my-app/node_modules/.pnpm/parse-multipart-data@1.5.0/node_modules/parse-multipart-data/dist/multipart.js?commonjs-exports', '\x00/private/tmp/test/my-app/node_modules/.pnpm/set-cookie-parser@2.6.0/node_modules/set-cookie-parser/lib/set-cookie.js?commonjs-es-import', '\x00/private/tmp/test/my-app/node_modules/.pnpm/set-cookie-parser@2.6.0/node_modules/set-cookie-parser/lib/set-cookie.js?commonjs-module', '/private/tmp/test/my-app/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/accepts@1.3.8/node_modules/accepts/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/vary@1.1.2/node_modules/vary/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/compressible@2.0.18/node_modules/compressible/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/bytes@3.0.0/node_modules/bytes/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/on-headers@1.0.2/node_modules/on-headers/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/regexparam@1.3.0/node_modules/regexparam/dist/regexparam.mjs', '/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/browser.js', '/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js', '/private/tmp/test/my-app/node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js', '/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/debug.js', '/private/tmp/test/my-app/node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json', '/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/encoding.js', '/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/mediaType.js', '/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/language.js', '/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/charset.js', '/private/tmp/test/my-app/node_modules/.pnpm/ms@2.0.0/node_modules/ms/index.js', '\x00/private/tmp/test/my-app/node_modules/.pnpm/compression@1.7.4/node_modules/compression/index.js?commonjs-es-import', '\x00/private/tmp/test/my-app/node_modules/.pnpm/compression@1.7.4/node_modules/compression/index.js?commonjs-module', '\x00zlib?commonjs-external', '\x00/private/tmp/test/my-app/node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js?commonjs-module', '\x00buffer?commonjs-external', '\x00/private/tmp/test/my-app/node_modules/.pnpm/bytes@3.0.0/node_modules/bytes/index.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/index.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/vary@1.1.2/node_modules/vary/index.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/index.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js?commonjs-exports', '\x00path?commonjs-external', '\x00/private/tmp/test/my-app/node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/index.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/mime-db@1.52.0/node_modules/mime-db/db.json?commonjs-proxy', '\x00/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/browser.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/node.js?commonjs-module', '\x00tty?commonjs-external', '\x00util?commonjs-external', '\x00fs?commonjs-external', '\x00net?commonjs-external', '\x00/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/charset.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/encoding.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/language.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/negotiator@0.6.3/node_modules/negotiator/lib/mediaType.js?commonjs-module', '\x00/private/tmp/test/my-app/node_modules/.pnpm/debug@2.6.9/node_modules/debug/src/debug.js?commonjs-module' ] } Node.js v19.8.1 ELIFECYCLE Command failed with exit code 1. ```Steps to reproduce:
bare
, sayyes
to server side rendering,yes
to typescriptpnpm install @suid/icons-material @suid/material
<Switch>Test</Switch>
to index.tsx and add an import likeimport {Switch} from "@suid/material"
pnpm build
It seems to come from some bundled version of Dynamic or something? It seems like solid has a server version of dynamic but not the correct one is used. Maybe also cc @ryansolid