File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,13 @@ async function initParserClass(): Promise<void> {
5959 parserInitPromise = ( async ( ) => {
6060 debugLog ( "importing web-tree-sitter..." )
6161 parserClass = ( await import ( "web-tree-sitter" ) ) . default
62- const treeSitterWasmPath = require . resolve ( "web-tree-sitter/tree-sitter.wasm" )
62+
63+ // Find wasm path relative to web-tree-sitter package at runtime
64+ const webTreeSitterPath = import . meta. resolve ( "web-tree-sitter" )
65+ const packageDir = webTreeSitterPath . replace ( / \/ [ ^ / ] + $ / , "" ) . replace ( "file://" , "" )
66+ const treeSitterWasmPath = `${ packageDir } /tree-sitter.wasm`
6367 debugLog ( "wasm path:" , treeSitterWasmPath )
68+
6469 await parserClass . init ( {
6570 locateFile : ( ) => treeSitterWasmPath ,
6671 } )
You can’t perform that action at this time.
0 commit comments