CSS Loader for codemirror.css
See original GitHub issueThis issue pertains to:
- GraphQL Playground React Component
What OS and OS version are you experiencing the issue(s) on?
macOS
What version of graphql-playground(-electron/-middleware) are you experience the issue(s) on?
^1.2.0
What is the expected behavior?
I can decide how to load CSS myself/given instructions on how to set up my react app to work with this lib
What is the actual behavior?
Codemirror css is imported inside the module, so I can’t load it in a way that works with next.js
Maybe document what loader is recommended to make this file load? I have a workaround to load it in next.js, so I can load the playground css via import playgroundCSS from 'graphql-playground/playground.css'
and inline it, but since the codemirror css is imported somewhere inside this lib, it’s out of my control.
What steps may we take to reproduce the behavior?
- create a directory
- add next
yarn add next react react-dom
- create file in pages folder
./pages/index.js
with contents:
import React from 'react'
import Playground from 'graphql-playground'
export default = () => <Playground endpoint={'/graphql'} />
- error:
Error in codemirror/lib/codemirror.css
Module parse failed: /Users/.../frontend-admin/node_modules/codemirror/lib/codemirror.css Unexpected token (3:0) You may need an appropriate loader to handle this file type. | /* BASICS */ | | .CodeMirror { | /* Set height, width, borders, and global font properties here */ | font-family: monospace;
tl:dr You may need an appropriate loader to handle this file type.
this will do all the steps for you (bash)
mkdir graphql-playground-issue-279 &&\
cd graphql-playground-issue-279 &&\
yarn init -y &&\
yarn add next react react-dom &&\
mkdir pages &&\
touch pages/index.js &&\\n
echo "import React from 'react'\\n
import Playground from 'graphql-playground'\\n
export default = () => <Playground endpoint={'/graphql'} />\
" >> pages/index.js &&\
./node_modules/.bin/next dev
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
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 >Module parse failed codemirror.css You may need an ... - GitHub
Module parse failed codemirror.css You may need an appropriate loader to handle this file type. #34.
Read more >CodeMirror does not work with React/Webpack - Stack Overflow
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 >Developer Guide - Vue Styleguidist
How it works; Webpack loaders and Webpack configuration; React components; Styles ... loaders/css-loader!codemirror/lib/codemirror.css').
Read more >CodeMirror: User Manual
CodeMirror is a code-editor component that can be embedded in Web pages. ... You must make sure the CSS file defining the corresponding...
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
Well done!
Everything it’s now inside
styled-components