problem with importing codemirror
See original GitHub issueTell me about your development environment.
- Node version: v8.9.3
- NPM version: 6.4.1
- Operating System: Windows 10
Describe the issue / bug.
hello I’m struggling with problem. I want to use this template with codemirror library. I have created clean project and everything I’ve done is replacing LandingPage.vue file with following content:
<template>
<div id="wrapper">
<textarea ref="ed" id="editor">
import someResource from 'codemirror/some-resource'
export default {
data () {
return {
exampleCode: 'const a = 10'
}
}
</textarea>
</div>
</template>
<script>
/* eslint-disable */
import CodeMirror from 'codemirror'
import 'codemirror/mode/javascript/javascript.js'
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/monokai.css'
export default {
name: 'landing-page',
mounted: function () {
CodeMirror.fromTextArea(document.getElementById('editor'), {
lineNumbers: true,
mode: 'text/javascript',
theme: 'monokai'
});
}
}
</script>
but javascript coloring scheme seems to not import
when i remove 2 first lines of imports and add to index.ejs this:
<script src="node_modules/codemirror/lib/codemirror.js"></script>
<script src="node_modules/codemirror/mode/javascript/javascript.js"></script>
it starts to working but of course it’s not my solution.
I thing its some problem in webpack confing.
Maybe sourcecode of codemirror/mode/javascript/javascript.js will help
bw
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
[Help] Running into loader-related issue when trying to use ...
Hi, I'm just starting out with programming and trying to implement CodeMirror into a Javascript React project I'm working on.
Read more >CodeMirror does not work with React/Webpack
Yes, it's an actual answer. You should just import some codemirror's css in your entrypoint file as it did in the example import...
Read more >CodeMirror 6 / Visnu Pitiyanuvath
Yet another way to import and use CodeMirror 6 within Observable. Skypack makes this easy. See also CodeMirror 6 Playground and CodeMirror inside...
Read more >uiw/react-codemirror
import React from 'react'; import CodeMirror from '@uiw/react-codemirror'; import { javascript } from '@codemirror/lang-javascript'; ...
Read more >Code Mirror Issue
import { Component, ViewChild } from. '@angular/core';. import { CodemirrorComponent } from '@ctrl/. ngx-codemirror';. import 'codemirror/mode/javascript/.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ok i had to add this to webpack renderer config
let whiteListedModules = ["vue", "codemirror", "vue-codemirror"];
issue can be closed
@XanderLuciano
eventually I’m going to use component made by @surmon-china (witch has same problem with importing code coloring with this boilerplate webpack config), but I’m using pure Codemirror to be sure where the problem occurs. unfortunately i’m going to use features of codemirror, but i take some time to find similar in Ace. for now i spended sleepless nigths to know why this line of import doesn’t works
thanks