solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

Changing `build.rollupOptions.output.entryFileNames` option in vite throws an error.

Open blvew opened this issue 3 years ago • 1 comments

the error thrown

Error: ENOENT: no such file or directory, copyfile '/home/nrb/tst/.solid/server/entry-server.js' -> '/home/nrb/tst/.solid/server/handler.js'
    at copyFileSync (node:fs:2866:3)
    at Object.build (file:///home/nrb/tst/node_modules/solid-start-node/index.js:32:7)

config

  build: {
    rollupOptions: {
      output: {
        entryFileNames: "entry.[hash].js",
        chunkFileNames: "chunks/chunk.[hash].js",
        assetFileNames: "assets/asset.[hash][extname]",
      },
    },
  },

take a look at this: https://github.com/solidjs/solid-start/blob/c1b0b13ee7ed1a52743d68ea4c195876a4c75493/packages/start-node/index.js#L32-L35

blvew avatar Oct 04 '22 05:10 blvew

I think solid-start is assuming you have entryFileNames: '[name].js' in server/SSR mode.

I think this may be fine for your use case. It is quite rare to need hashes in the file name on the server side, only on the browser side. Maybe try customizing entryFileNames for the browser build only? Here are some examples from other Vite projects:

https://github.com/vitejs/vite/blob/07d3fbd21e6b63a12997d201a2deb5b2f2129882/packages/vite/src/node/build.ts#L547 https://github.com/sveltejs/kit/blob/5a54eb4af542a4b0c3b4c589c3df3ea520f5ca00/packages/kit/src/exports/vite/build/utils.js#L124

patdx avatar Oct 13 '22 05:10 patdx