Giter Club home page Giter Club logo

Comments (12)

nksaraf avatar nksaraf commented on July 30, 2024 1

Can I get a repro of this? I am not sure why this is happening? Could be a bug

from vinxi.

nksaraf avatar nksaraf commented on July 30, 2024

Yeah this one is tricky. Vinxi does the server and static assets slightly differently from vite. We have this concept of routers and each public directory is just another router. So the default solid-start app config is approximately this:

import { serverFunctions } from "@vinxi/server-functions/plugin";
import { createApp } from "vinxi";
import solid from "vite-plugin-solid";

export function defineConfig(options) { 
    return createApp({
		routers: [
			{
				name: "public",
				mode: "static",
				dir: "./public",
				base: "/",
			},
			{
				name: "client",
				mode: "build",
				handler: "./app/client.tsx",
				target: "browser",
				plugins: () => [serverFunctions.client(), solid({ ssr: true })],
				base: "/_build",
			},
			{
				name: "ssr",
				mode: "handler",
				handler: "./app/server.tsx",
				target: "server",
				plugins: () => [solid({ ssr: true })],
			},
			serverFunctions.router(),
		],
	});
}

What you can do to add another router to the mix is:

import { defineConfig } from '@solidjs/start/config'
const config = defineConfig({ ... })

config.addRouter({
  mode: "static",
  name: "solid-start-cmp",
  dir: "node_modules/solid-start-cmp/public",
  base: "/",
});

export default config;

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

Now I have this error :

demo-ventes git:(solid-migration) ✗ pnpm build

> demo-ventes@ build /home/quentin/Documents/dev/madeformed/demo-ventes
> vinxi build

Error: Cannot find module './plugins/decorate-exports.js'
Require stack:
- /home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vinxi/plugin-directives/index.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Function.resolve (node:internal/modules/cjs/helpers:125:19)
    at _resolve (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:250334)
    at jiti (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:252917)
    at /home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vinxi/plugin-directives/index.js:2:24
    at evalModule (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:255614)
    at jiti (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:253542)
    at /home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vinxi/server-functions/client.js:1:186
    at evalModule (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:255614)
    at jiti (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:253542)
    at /home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vinxi/server-functions/plugin.js:3:15
    at evalModule (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:255614)
    at jiti (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:253542)
    at /home/quentin/Documents/dev/madeformed/demo-ventes/app.config.js:1:213
    at evalModule (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:255614)
    at Object.jiti (/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/jiti/dist/jiti.js:1:253542)
    at resolveConfig (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:288:24)
    at loadConfig (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/c12/dist/index.mjs:116:40)
    at loadApp (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vinxi/lib/load-app.js:16:31)
    at Object.run (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vinxi/bin/cli.mjs:176:23)
    at async runCommand (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:316:16)
    at async runCommand (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:307:11)
    at async runMain (file:///home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:441:7) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected]/node_modules/@vinxi/plugin-directives/index.js'
  ]
}


┌────────────────────────────┐
│ ⚙  Building your app...    │
└────────────────────────────┘

 ERROR  Cannot read properties of undefined (reading 'hooks')                                                                                                  6:31:47 AM

  at createBuild (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vinxi/lib/build.js:39:12)
  at Object.run (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected]/node_modules/vinxi/bin/cli.mjs:179:11)
  at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:316:16)
  at async runCommand (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:307:11)
  at async runMain (node_modules/.pnpm/[email protected]/node_modules/citty/dist/index.mjs:441:7) 



 ERROR  Cannot read properties of undefined (reading 'hooks')                                                                                                  6:31:47 AM

 ELIFECYCLE  Command failed with exit code 1.
 
 ```

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

@nksaraf is it possible to reopen it ?

from vinxi.

nksaraf avatar nksaraf commented on July 30, 2024

Ohh this was a dumb mistake where I didn't include plugin folder in the files for the directives plugin. Should be working in latest versions of these packages. i.e 0.0.57

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024
 demo-ventes git:(solid-migration) ✗ pnpm build

> demo-ventes@ build /home/quentin/Documents/dev/madeformed/demo-ventes
> vinxi build

vinxi 0.0.59
The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.


┌────────────────────────────┐
│ ⚙  Building your app...    │
└────────────────────────────┘


┌──────────────────────────────────┐
│ 📦 Compiling client router...    │
└──────────────────────────────────┘
vinxi building router client in build mode
[ '#vinxi/handler/client' ]
vite v4.5.0 building for production...
✓ 6 modules transformed.
✓ built in 127ms
[vite]: Rollup failed to resolve import "#start/app" from "/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@solidjs/start/client/StartClient.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

[11:38:07 AM]  ERROR  [vite]: Rollup failed to resolve import "#start/app" from "/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@solidjs/start/client/StartClient.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external

  This is most likely unintended because it can break your application at runtime.
  If you do want to externalize this module explicitly add it to
  build.rollupOptions.external
  at viteWarn (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:48216:27)
  at onRollupWarning (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:48248:9)
  at onwarn (node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:47976:13)
  at node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:24276:13
  at Object.logger [as onLog] (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:25950:9)
  at ModuleLoader.handleInvalidResolvedId (node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:24862:26)
  at node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:24822:26 



[11:38:07 AM]  ERROR  [vite]: Rollup failed to resolve import "#start/app" from "/home/quentin/Documents/dev/madeformed/demo-ventes/node_modules/.pnpm/@[email protected][email protected][email protected][email protected][email protected]/node_modules/@solidjs/start/client/StartClient.tsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external

 ELIFECYCLE  Command failed with exit code 1.
 ```
 @nksaraf 

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

I don't have such import

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

repro : https://github.com/qlaffont/test-cmp

from vinxi.

nksaraf avatar nksaraf commented on July 30, 2024

nksaraf/test-cmp@5529e8f should have the latest commit with the fixes. I think there was some miscommunication with the first fix. solid-start's defineConfig is already creating the main thing for you. You had to add the addRouter part to the bottom of vite.config.js itself.

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

Yes it working ! Thanks !

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

@nksaraf I have an issue with my vite plugin "unplugin-imagemin/vite" can you check please.

It's the same repo but you need to rebase.

> test-cmp@ build /home/quentin/Documents/dev/test/test-cmp
> vinxi build

vinxi 0.0.60
start {
  appRoot: './src',
  ssr: false,
  islands: false,
  server: { base: undefined },
  solid: {}
}
vinxi Found vite.config.js with app config


┌────────────────────────────┐
│ ⚙  Building your app...    │
└────────────────────────────┘
removing /home/quentin/Documents/dev/test/test-cmp/.vinxi/build/ssr
removing /home/quentin/Documents/dev/test/test-cmp/.vinxi/build/client
removing /home/quentin/Documents/dev/test/test-cmp/.vinxi/build/server-fns


┌───────────────────────────────┐
│ 📦 Compiling ssr router...    │
└───────────────────────────────┘
vinxi building router ssr in handler mode
vite v4.5.0 building SSR bundle for production...
"createHandler" is imported from external module "h3" but never used in "node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/vinxi/runtime/server.js".
✓ 40 modules transformed.
.vinxi/build/ssr/manifest.json                   1.40 kB
.vinxi/build/ssr/assets/index-fb87c914.css      46.63 kB
.vinxi/build/ssr/_...404_.js                     0.74 kB
.vinxi/build/ssr/about.js                        0.96 kB
.vinxi/build/ssr/assets/components-86ea9901.js   1.20 kB
.vinxi/build/ssr/index.js                        3.61 kB
.vinxi/build/ssr/ssr.js                          6.50 kB


[unplugin-imagemin] 📦 📦 Process start with Mode sharp
✓ built in 743ms
✔ build done                                                                                                                                                  7:01:06 AM


┌──────────────────────────────────┐
│ 📦 Compiling client router...    │
└──────────────────────────────────┘
vinxi building router client in build mode
[
  '#vinxi/handler/client',
  '/home/quentin/Documents/dev/test/test-cmp/src/routes/[...404].tsx?pick=default&pick=$css',
  '/home/quentin/Documents/dev/test/test-cmp/src/routes/about.tsx?pick=default&pick=$css',
  '/home/quentin/Documents/dev/test/test-cmp/src/routes/index.tsx?pick=default&pick=$css'
]
plugin-legacy overrode 'build.target'. You should pass 'targets' as an option to this plugin with the list of legacy browsers to support instead.
vite v4.5.0 building for production...
virtual:#vinxi/handler/client (1:106) "default" is not exported by "src/entry-client.tsx", imported by "virtual:#vinxi/handler/client".
✓ 115 modules transformed.
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, open '/home/quentin/Documents/dev/test/test-cmp/.vinxi/build/client/_build/assets/_...404_-legacy-ca63b2ec.js'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/quentin/Documents/dev/test/test-cmp/.vinxi/build/client/_build/assets/_...404_-legacy-ca63b2ec.js'
}

Node.js v18.17.1
 ELIFECYCLE  Command failed with exit code 1.```

from vinxi.

qlaffont avatar qlaffont commented on July 30, 2024

@nksaraf any update ?
I have update to vinxi 0.1.1 bug still present.

from vinxi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.