solidjs/vite-plugin-solid

Vite does not load proper build (server) on ssr webworker build

Opened this issue · 5 comments

While building the ssr bundle with ssr.target = "webworker", it looks like the default web builds of vite is being bundled. I have these in my vite config but it is no help.

resolve: {
  conditions: ["worker", "webworker"],
},

Only when I add aliases to correct builds, then it works:

resolve: {
  conditions: ["worker", "webworker"],
  alias: {
    "solid-js/web": "solid-js/web/dist/server",
    "solid-js": "solid-js/dist/server",
  },
},

Here's my complete config:

Details

{
  appType: "custom",
  resolve: {
    conditions: ["worker", "webworker"],
    alias: {
      "solid-js/web": "solid-js/web/dist/server",
      "solid-js": "solid-js/dist/server",
    },
  },
  build: {
    outDir: "dist",
    manifest: false,
    chunkSizeWarningLimit: 1024 * 1024,
    emptyOutDir: false,
    ssrEmitAssets: false,
    copyPublicDir: false,
    assetsDir: ".worker",
    rollupOptions: {
      input: "virtual:worker-entry",
      output: {
        entryFileNames: "_worker.js",
        inlineDynamicImports: false,
      },
    },
    ssr: true,
  },
  ssr: {
    target: "webworker",
    noExternal: true,
  },
};

Probably related to #116

This also works:

resolve: {
  conditions: ["worker", "webworker"],
  mainFields: ["module"],
}

Astro users face the same issue, the package.json should be fixed in solid itself: https://publint.dev/solid-js@1.8.17

@ryansolid Is this adapter dead? Last commit 5 months ago?

I require the astro cloudflare integration which works only with fixing this issue.