thlorenz / brace

📔 browserify compatible version of the ace editor.
http://thlorenz.github.io/brace/
MIT License
1.06k stars 304 forks source link

how to use brace in es6 #117

Closed cookieY closed 6 years ago

cookieY commented 6 years ago

var ace = require('brace'); require('brace/mode/javascript'); require('brace/theme/monokai');

var editor = ace.edit('javascript-editor'); editor.getSession().setMode('ace/mode/javascript'); editor.setTheme('ace/theme/monokai');

ERROR:

Error in mounted hook: "TypeError: Cannot read property 'edit' of undefined"

woowalker commented 4 years ago

i got this problem, and i want to know how to fix it ? @cookieY

ma-x-x commented 4 years ago

me too

cookieY commented 4 years ago

@longmajuxie u can try this

const ace = require('brace') let editor = ace.edit('javascript-editor')

ma-x-x commented 4 years ago

@longmajuxie u can try this

const ace = require('brace') let editor = ace.edit('javascript-editor')

@longmajuxie u can try this

const ace = require('brace') let editor = ace.edit('javascript-editor')

no working. const ace = require('brace'); console.log('===', ace);

when i use console.log, display === undefined. but i can found brace in node_modules.

cpkuo commented 2 years ago

I had the same issue. For me, I had accidentally referenced ace.js from a script tag in my page.