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

Fix vite support #84

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Fix vite support #84

wants to merge 2 commits into from

Conversation

NullVoxPopuli
Copy link
Contributor

@NullVoxPopuli NullVoxPopuli commented Nov 5, 2024

Related to: https://discord.com/channels/804011606160703521/1303171812347215872/1303171812347215872

Under vite, through ember-repl -> content-tag, was getting this error:

`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. 
  Falling back to `WebAssembly.instantiate` which is slower. 
  Original error:
     TypeError: 
        WebAssembly: 
          Response has unsupported MIME type 'text/html' 
          expected 'application/wasm' standalone-IQRAU4AM.js:252:19
Uncaught (in promise) wasm validation error: 
  at offset 4: failed to match magic number compiler.js:53:17

over here: universal-ember/kolay#134

(making an actual type=module addon)

The code here is patched in to the above PR.


However, with changing default to node, we get a types error for the bundler check from are-the-types-wrong

exports
"exports": {
    ".": {
      "browser": {
        "types": "./index.d.ts",
        "default": "./pkg/standalone.js"
      },
      "node": {
        "types": "./index.d.cts",
        "default": "./pkg/node.cjs"
      }
    }
},
error

💀 Import failed to resolve to type declarations or JavaScript files. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md


┌───────────────────┬──────────────────────┐
│                   │ "content-tag"        │
├───────────────────┼──────────────────────┤
│ node10            │ 🟢                   │
├───────────────────┼──────────────────────┤
│ node16 (from CJS) │ 🟢 (CJS)             │
├───────────────────┼──────────────────────┤
│ node16 (from ESM) │ 🟢 (CJS)             │
├───────────────────┼──────────────────────┤
│ bundler           │ 💀 Resolution failed │
└───────────────────┴──────────────────────┘
Error: Process completed with exit code 1.

If I change it to use import and require for the top-level conditions this occurs

exports
  "exports": {
    ".": {
      "import": {
        "types": "./index.d.ts",
        "default": "./pkg/standalone.js"
      },
      "require": {
        "types": "./index.d.cts",
        "default": "./pkg/node.cjs"
      }
    }
  },
error
failed to load config from /home/nvp/Development/NullVoxPopuli/kolay/docs-app/vite.config.mjs
error when starting dev server:
TypeError: fetch failed
    at node:internal/deps/undici/undici:13392:13
    at async __wbg_init (file:///home/nvp/Development/NullVoxPopuli/kolay/node_modules/.pnpm/[email protected]_patch_hash=36mmqi45qjbnwqjmwt7cs6ua5y/node_modules/content-tag/pkg/standalone/content_tag.js:504:51)
    at async file:///home/nvp/Development/NullVoxPopuli/kolay/node_modules/.pnpm/[email protected]_patch_hash=36mmqi45qjbnwqjmwt7cs6ua5y/node_modules/content-tag/pkg/standalone.js:4:1
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.

@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant