Hi everyone. I’m a newbie to Codemirror v6, and I’m a dabbler not a programmer, so bear with me.
I’m trying to enable lang-tex from this repository.
Here is a simple example that already generates the problem:
import {EditorView, basicSetup} from "codemirror";
import {texSyntax} from "lang-tex";
let editor = new EditorView({
extensions: [basicSetup, texSyntax()],
parent: document.getElementById("editorparent")
});
export default editor;
When I run the bundler:
node_modules/.bin/rollup test.mjs -f iife -o editor.bundle.js -p @rollup/plugin-node-resolve
I get this output:
test.mjs → editor.bundle.js...
(!) "this" has been rewritten to "undefined"
https://rollupjs.org/troubleshooting/#error-this-is-undefined
node_modules/lang-tex/lib/index.js
1: "use strict";
2: var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
^
3: if (k2 === undefined) k2 = k;
4: Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
...and 3 other occurrences
[!] RollupError: "texSyntax" is not exported by "node_modules/lang-tex/lib/index.js", imported by "test.mjs".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
test.mjs (2:8)
1: import {EditorView, basicSetup} from "codemirror";
2: import {texSyntax} from "lang-tex";
^
3:
4: let editor = new EditorView({
at error (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:349:30)
at Module.error (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:15061:16)
at Module.traceVariable (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:15486:29)
at ModuleScope.findVariable (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:14011:39)
at Identifier.bind (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:9731:40)
at CallExpression.bind (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:7351:23)
at CallExpression.bind (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:11297:15)
at ArrayExpression.bind (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:7347:28)
at Property.bind (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:7351:23)
at ObjectExpression.bind (/home/kck/http/typesetting/open-guide-editor/node_modules/rollup/dist/shared/rollup.js:7347:28)
Exit code: 1
I’m hoping I’m just doing something simple wrongly. But I’ve been struggling in general understanding many of the intricacies of v6
Or is there another extension that provides LaTeX language support?