Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
eknkc opened this issue Mar 11, 2024 · 5 comments
Open

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

eknkc opened this issue Mar 11, 2024 · 5 comments

Comments

@eknkc
Copy link

eknkc commented Mar 11, 2024

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,
  },
};
@eknkc
Copy link
Author

eknkc commented Mar 11, 2024

Probably related to #116

@eknkc
Copy link
Author

eknkc commented Mar 11, 2024

This also works:

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

@alexanderniebuhr
Copy link

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

@bluwy
Copy link
Contributor

bluwy commented May 17, 2024

Also related: solidjs/solid-start#263

@deeprobin
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants