sass.js icon indicating copy to clipboard operation
sass.js copied to clipboard

Web Assembly

Open matthew-dean opened this issue 7 years ago • 13 comments

Will you be adding web assembly builds soon? Or is the Web Assembly MVP not sufficient enough for libsass?

matthew-dean avatar Feb 02 '17 22:02 matthew-dean

I have not dabbled with WebAssembly yet and I don't plan to in the sort term, but I'm sure sass.js will eventually be a WebAssembly thing.

rodneyrehm avatar Feb 03 '17 08:02 rodneyrehm

I've tried my luck with WebAssembly but wasn't able to make native-wasm work.

-s WASM=1 -o test.html will generate eveything needed for execution, but I get the following error:

trying binaryen method: native-wasm
failed to compile wasm module: RangeError: WebAssembly.Module(): Wasm compilation exceeds internal limits in this context for the provided arguments
Uncaught no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods

Firefox and Chrome can't run the generated test.wasm directly either, they abort because of a version mismatch. … will try again in a few weeks.

rodneyrehm avatar Jun 25 '17 11:06 rodneyrehm

Via a tweet I noticed that @AshKyd made some changes to sass.js to get wasm to work.

@AshKyd do you want to send a PR for that? Does this still work in browsers not supporting WASM?

rodneyrehm avatar Aug 06 '17 09:08 rodneyrehm

@rodneyrehm Was more a learning experience. It doesn't work in Node 8 (not sure why), and there's no fallback either so it's not mergeable without more work.

I can't commit to anything, but if nobody else picks it up I might have another look when I have some time. :)

AshKyd avatar Aug 06 '17 09:08 AshKyd

FYI: https://github.com/sass/node-sass/pull/2220

mgreter avatar Feb 06 '18 01:02 mgreter

Thanks for the nudge @mgreter - I've just released a beta for WASM: 0.11.0-beta.1

Please try it out and tell me if something goes wrong with the relative loading of libsass.wasm. Not sure if I should consider this a (potentially) breaking change or not…

rodneyrehm avatar Feb 06 '18 20:02 rodneyrehm

Hey

I am currently testing the WASM beta and at least for a simple use case it works fine with no issues.

My use case is a Browser-based Monaco Editor sass => sass.js => inject to styles -WYSIWYG editor.

aapoalas avatar Mar 05 '18 13:03 aapoalas

I guess we'll have to try some more (and probably produce a bigger build), because IE11 doesn't support WASM…

no native wasm support detected
no binaryen method succeeded. consider enabling more options, like interpreting, if you want that: https://github.com/kripken/emscripten/wiki/WebAssembly#binaryen-methods

rodneyrehm avatar Mar 06 '18 17:03 rodneyrehm

https://gist.github.com/surma/b2705b6cca29357ebea1c9e6e15684cc might help with switching from this archaic grunt build thing to webpack with support for wasm.

rodneyrehm avatar May 27 '18 09:05 rodneyrehm

https://developer.microsoft.com/en-us/microsoft-edge/platform/status/webassemblymvp/ suggests that Edge is now supporting WASM as well

rodneyrehm avatar May 27 '18 09:05 rodneyrehm

Can we get a new WebAssembly build after all these updates? :)

bundyo avatar May 21 '19 10:05 bundyo

Can we get a new WebAssembly build after all these updates? :)

were you using the 0.11.0-beta.1 build already?

rodneyrehm avatar May 21 '19 16:05 rodneyrehm

Yes, it is about 2 seconds faster for my setup.

bundyo avatar May 21 '19 16:05 bundyo