Giter VIP home page Giter VIP logo

codemirror-tex's People

Contributors

jun-sheaf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

hubgit rust-torch

codemirror-tex's Issues

Cannot bundle with rollup as suggested in codemirror docs

Overview.

I am getting an error with this package when trying to make use of it in a codemirror project.

I'm a newbie to codemirror, and just a dabbler not a full time programmer so bear with me.

The error for me can be produced as easily as the following:

Steps to reproduce.

  1. Create a new project with npm init.

  2. Install codemirror and rollup/@rollup-plugin-node-resolve along with this project: npm install codemirror lang-tex rollup @rollup/plugin-node-resolve.

  3. Create a javascript module that loads the package. I can get the problem with something as simple as this:

import {EditorView, basicSetup} from "codemirror";
import {texSyntax} from "lang-tex";

let editor = new EditorView({
    extensions: [basicSetup, texSyntax()],
    parent: document.body
});

export default editor;
  1. Try to use rollup to bundle the dependencies needed for codemirror with this extension, using node_modules/.bin/rollup editor.mjs -f iife -o editor.bundle.js -p @rollup/plugin-node-resolve as suggested here.

When I do so I get this output:

editor.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 "editor.mjs".
https://rollupjs.org/troubleshooting/#error-name-is-not-exported-by-module
editor.mjs (3:8)
1:
2: import {EditorView, basicSetup} from "codemirror";
3: import {texSyntax} from "lang-tex";
           ^
4:
5: let editor = new EditorView({
    at error (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:349:30)
    at Module.error (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:15073:16)
    at Module.traceVariable (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:15498:29)
    at ModuleScope.findVariable (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:14023:39)
    at Identifier.bind (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:9743:40)
    at CallExpression.bind (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:7363:23)
    at CallExpression.bind (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:11309:15)
    at ArrayExpression.bind (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:7359:28)
    at Property.bind (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:7363:23)
    at ObjectExpression.bind (/home/frabjous/tmp/textest/node_modules/rollup/dist/shared/rollup.js:7359:28)

The expected behavior is that I not get this error, and that I be able to use the extension in a simple codemirror instance.

It's possible I just didn't install things right. Again, newbie.

Versions

  • codemirror v 6.0.1
  • lang-tex 0.0.3
  • @rollup/plugin-node-resolve 15.1.0
  • rollup 3.26.2

I did get a lot of deprecation warnings about lezer packages when installing lang-tex, which may or may not be relevant.

Note I posted about this in the codemirror discussion forum here but didn't get any replies.

bug(lezer-tex): initialization Problem

Describe the bug
When I enter "\" at an Editor that inits with blank content, the browser would pop up this error. However, If enter some other keys first, then enter "\", everything is going completely correct.

Screenshots
截屏2021-06-20 下午7 17 02

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.