Skip to content

Fix for error when used with recent vite and vinxi #222

Open
@kshepherd2013

Description

@kshepherd2013

I include the complete fix, and can create a pull request if you wish.
The change is to simply add safety checking on two input parameters.

I attempted to upgrade our use of vite-plugin-solid to v2.7.11, along with an upgrade of vinxi to v0.5.8 and also vite to v5.4.19 in a cloudflare wrangler solidjs environment.
Versions not working (I also see the same lines in the latest src):
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
@solidjs/[email protected]
@solid-primitives/[email protected]
@solidjs/[email protected]
@solidjs/[email protected]

Versions which DO work:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
@solidjs/[email protected]
@solid-primitives/[email protected]
@solidjs/[email protected]
@solidjs/[email protected]

We get a build breaking error of:
TypeError: config.resolve.conditions is not iterable
This is completely fixed by changing lines 293 and 295 of vite-plugin-solid/src/index.ts
from:
293: config.resolve.conditions = [...defaultClientConditions];
295: config.resolve.conditions = [...defaultServerConditions];
to:
293: config.resolve.conditions = defaultClientConditions?[...defaultClientConditions]:[];
295: config.resolve.conditions = defaultServerConditions?[...defaultServerConditions]:[];

Here is the complete build log:
npm run build

build
COMPATIBILITY_DATE=2024-11-23 npm run build:tw && vinxi build

build:tw
tailwindcss -i src/tailwind.css -o .vinxi/build/client/_build/assets/twstyles.css --minify

Browserslist: caniuse-lite is outdated. Please run:
npx update-browserslist-db@latest
Why you should do it regularly: https://github.com/browserslist/update-db#readme

Rebuilding...
(node:2946040) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)

Done in 1299ms.
vinxi v0.5.8

⚙ Building your app...
removing /nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/apps/designer-wearshare-com/.vinxi/build/client
vinxi v0.5.8

⚙ Building your router ssr...

📦 Compiling ssr router...
vinxi building router ssr in http mode
Error building router ssr: TypeError: config.resolve.conditions is not iterable
at configEnvironment (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vite-plugin-solid/dist/esm/index.mjs:136:169)
at async runConfigEnvironmentHook (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:49457:19)
at async resolveConfig (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:48831:3)
at async createBuilder (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:46707:18)
at async Module.build (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/node_modules/vite/dist/node/chunks/dep-DBxKXgDP.js:45981:19)
at async createViteBuild (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/lib/build.js:413:17)
at async createRouterBuild (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/lib/build.js:547:2)
at async file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/lib/build.js:61:7
at async createBuild (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/lib/build.js:59:5)
at async Object.run (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/vinxi/bin/cli.mjs:246:6)
Error building router ssr: Error: Exited with code: 1
at CommandChild.pipedStdoutBuffer (file:///nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/node_modules/dax-sh/esm/mod.js:8476:19)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
npm error Lifecycle script build failed with error:
npm error code 1
npm error path /nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/apps/designer-wearshare-com
npm error workspace designer-wearshare-com
npm error location /nfs/shepherd4_Development/scarletline/cyber/src/usr/wearshare/sites/apps/designer-wearshare-com
npm error command failed
npm error command sh -c COMPATIBILITY_DATE=2024-11-23 npm run build:tw && vinxi build

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions