diff options
author | Joel Spadin <joelspadin@gmail.com> | 2020-11-07 18:03:20 -0600 |
---|---|---|
committer | innovaker <66737976+innovaker@users.noreply.github.com> | 2020-12-10 12:23:05 +0000 |
commit | 5aa8a07aa9d15639e0315fef12d208040c739b7f (patch) | |
tree | 2f2445a37ba82a9d6e8dd82e556b3b1fb72d333b /docs/src/docusaurus-tree-sitter-plugin/index.js | |
parent | 77c16b020e697eb301eeaa955d901e9a3fc6586c (diff) |
feat(docs): add keymap upgrader
Added a documentation page with a script that upgrades deprecated key
codes and behaviors to their replacements.
Fixes #299
Diffstat (limited to 'docs/src/docusaurus-tree-sitter-plugin/index.js')
-rw-r--r-- | docs/src/docusaurus-tree-sitter-plugin/index.js | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/docs/src/docusaurus-tree-sitter-plugin/index.js b/docs/src/docusaurus-tree-sitter-plugin/index.js new file mode 100644 index 0000000..7803a9e --- /dev/null +++ b/docs/src/docusaurus-tree-sitter-plugin/index.js @@ -0,0 +1,39 @@ +module.exports = function () { + return { + configureWebpack(config, isServer) { + let rules = []; + + // Tree-sitter is only used for client-side code. + // Don't try to load it on the server. + if (isServer) { + rules.push({ + test: /web-tree-sitter/, + loader: "null-loader", + }); + } else { + // web-tree-sitter has a hard-coded path to tree-sitter.wasm, + // (see https://github.com/tree-sitter/tree-sitter/issues/559) + // which some browsers treat as absolute and others as relative. + // This breaks everything. Rewrite it to always use an absolute path. + rules.push({ + test: /tree-sitter\.js$/, + loader: "string-replace-loader", + options: { + search: '"tree-sitter.wasm"', + replace: '"/tree-sitter.wasm"', + strict: true, + }, + }); + } + + return { + // web-tree-sitter tries to import "fs", which can be ignored. + // https://github.com/tree-sitter/tree-sitter/issues/466 + node: { + fs: "empty", + }, + module: { rules }, + }; + }, + }; +}; |