Giter Site home page Giter Site logo

Range is not a constructor about ace-diff HOT 5 OPEN

ace-diff avatar ace-diff commented on June 7, 2024
Range is not a constructor

from ace-diff.

Comments (5)

Benjamin-Dobell avatar Benjamin-Dobell commented on June 7, 2024 7

Seems as ace-diff looks first for Range on ace (as provided to the AceDiff constructor), you can work around this issue with:

import ace from 'brace'
ace.Range = ace.acequire("ace/range").Range

from ace-diff.

JackuB avatar JackuB commented on June 7, 2024

That's not the error I'm seeing on the link you've shared:

Screenshot 2020-07-07 at 11 46 14

Don't see ace-builds being included there. If you include it (globally 2nd line or with options), it seems to be working

Screenshot 2020-07-07 at 11 49 47

from ace-diff.

Nik3181 avatar Nik3181 commented on June 7, 2024

there is a dependency section on the bottom left corner, please try changing it to 3.0.3. including ace-builds didn't help either.

from ace-diff.

Benjamin-Dobell avatar Benjamin-Dobell commented on June 7, 2024

I've ran into this also using brace and webpack. The underlying cause is as follows:

Screen Shot 2020-08-13 at 12 09 17 am

i.e. Brace's Range module exports an object with a Range value, rather than exporting a function. Brace always requires the Range module than grabs the exported Range property e.g

https://github.com/thlorenz/brace/blob/3a00c5d59777f9d826841178e1eb36694177f5e6/mode/tcl.js#L5

Where as ace-diff attempts to use the exported value directly as a function/constructor, hence the error.

EDIT: Ace Editor itself also requires, then grabs the underlying property:

https://github.com/ajaxorg/ace/blob/aaf90777d05980489c411dc16ba63476eed14e63/lib/ace/keyboard/vim_ace_test.js#L41

This is my first time using Ace so I can only speculate, but presumably the Range module was changed recently to export an object, not a function.

from ace-diff.

krmckone avatar krmckone commented on June 7, 2024

@Benjamin-Dobell This works for me using vuejs/webpack thanks for the workaround.

from ace-diff.

Related Issues (20)

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.