Bundling for browser usage
See original GitHub issueHi, not really an issue, just wondering if it’s actually possible to use Shiki in browser instead of node?
I have tried to bundle it with webpack and https://github.com/Jam3/babel-plugin-static-fs plugin, but still getting errors related to fs
module calls for Onigasm
and etc.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Smart Bundling: How To Serve Legacy Code Only To Legacy ...
A quick look at caniuse.com's usage table reveals that evergreen browsers occupy a lion's share of the browser market — more than 75%....
Read more >Demystifying Code Bundling with JavaScript Modules
Of course, bundling often means an increase in file size. Since website loading time is a prime concern for users, it's important to...
Read more >GitHub - laander/is-bundling-for-browser-or-node
Uses package.json fields "browser" and "main" to check whether code is bundled for browser or node - GitHub ...
Read more >How does browser support impact JavaScript bundle size?
Dropping support for older browsers, or serving separate bundles to them, can help reduce JavaScript bundle size.
Read more >Browserify
Browserify lets you require('modules') in the browser by bundling up all of your dependencies. Install Documentation · Source Code · Help + Articles...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Author of
onigasm
here. There is absolutely no problem running it in browsers, in fact, it was designed to be run in browsers for one of my own projects (now defunct).It works perfectly fine with
webpack
with minimal config changes, just define a rule in webpack config to usefile-loader
for any import asking for*.wasm
file.Input
Output
@canibanoglu Even if that’s doable, is it desirable at all? Loading several MB of WASM and then the grammars to do syntax highlighting on client side? I initially thought of shiki as an library, on either a static site generator system or locally, to faithfully reproduce VS Code’s highlighting. I still think that’s useful enough. If you need to dynamically do syntax highlighting in browser, maybe Monaco or Highlight.js would be better choices?