-
Notifications
You must be signed in to change notification settings - Fork 189
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
possible to use in stackblitz? #386
Comments
You could try |
I get a different error with
Maybe I'm using it wrong? https://stackblitz.com/edit/node-scwtnr?file=package.json,index.js |
You need to initialize the wasm module first: https://lightningcss.dev/docs.html#from-deno-or-in-browser I tried this, but Stackblitz doesn't support fetch? https://stackblitz.com/edit/node-jja2wu?file=package.json,index.js |
ah, that's because it's running node 16. stackblitz/webcontainer-core#560 (comment) maybe it could be polyfilled in |
It does work if you read the WASM file yourself and pass it to await init(
fs.readFileSync('node_modules/lightningcss-wasm/lightningcss_node.wasm')
); https://stackblitz.com/edit/node-jja2wu?file=package.json,index.js I also tried using |
We might be able to add some detection to the wasm loader to do this automatically https://github.com/parcel-bundler/lightningcss/blob/master/wasm/index.mjs |
something like this? i can submit a PR (edit: see #387) const fetchOrRead = async (from) => {
try {
const fs = await import('fs');
return fs.readFileSync(from);
} catch {
return fetch(from);
}
}; - input = fetch(input);
+ input = fetchOrRead(input); |
When running in stackblitz, I get this error when importing lightningcss:
See repro (same project works fine locally): https://stackblitz.com/edit/node-n6my9w?file=index.js
The text was updated successfully, but these errors were encountered: