Error importing codemirror library in SCSS
Question
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Firefox 112.0.1
Reproducible demo link
https://github.com/davidrhoderick/grapesjs-test
Describe the bug
How to reproduce the bug?
- Follow getting started (you can see the structure I am following with a basic Parcel project with Typescript & SCSS)
- When you get to the "Theming" step, you'll get an error trying to import Grapes SCSS.
What is the expected behavior? That if I follow the "Getting started" tutorial, everything works.
What is the current behavior? When I get to the step that should allow me to customize the appearance of the application with SCSS, I get the following error:
@parcel/transformer-sass: expected "{".
β·
11 β typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
β ^
β΅
node_modules/codemirror/lib/codemirror.js 11:48 @import
node_modules/grapesjs/src/styles/scss/main.scss 2:9 @import
src/styles.scss 10:9 @import
src/index.html 2:15 root stylesheet
If is necessary to execute some code in order to reproduce the bug, paste it here below:
npm run dev
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (3)
Funnily enough, the CSS-based styling works.
Looks like the Parcel transformer is trying to import codemirror/lib/codemirror.js instead of codemirror/lib/codemirror.css on this line:
@import "codemirror/lib/codemirror";
So I'd suggest to open the issue on the related package
Thanks for reporting this, @davidrhoderick.
Great suggestion about Error importing codemirror library in SCSS! While this specific feature isn't yet in the core API, there are several ways to achieve similar behavior.
Using the event system:
editor.on('component:update', (component) => {
// your logic here
});
Alternative approaches:
- Listen to
selector:addfor CSS selector changes - Use
selector:customfor custom rules - Tap into the
change:*events for fine-grained tracking - Build a plugin that extends the editor with this capability
Making it official: If this feature would benefit many users, consider opening a formal Feature Request on the GrapesJS repo with:
- A detailed use case
- Code example showing the desired behavior
- Why this matters for your workflow
The core team is receptive to well-motivated feature requests backed by real use cases.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4191
We are trying to store the data from grapesJS editor in Angular 10 application, getting CORS error, image attached below
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 99.0.4844.5 Reproducible demo link...
Issue #5583
Can't set background:none in mobile version using styles panel
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Edge last version Reproducible demo link h...
Issue #5263
Deleting a component without deleting its corresponding style, will adding new components later cause style conflicts?
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? latest version of Chrome Reproducible demo...
Issue #4448
Error on resize image.
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Brave Browser Last version Reproducible de...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Tutorial
Find the Right GrapesJS Plugin in Seconds: Smarter Discovery Is Live
We're shipping a set of discovery upgrades. New label filters, a proper compatibility switch for GrapesJS vs Studio, one-click and a smarter sort bar.
Tutorial
GrapesJS vs Webflow vs Tilda: What to Choose for Your Business in 2026
Choosing the right website platform in 2026 is no longer just about building a site
Tutorial
GJS Market 2.0 - Donations, Tracking, Labels and Better Product Discovery
Weβve rolled out a new set of GrapesJS marketplace updates across GJS Market, focused on improving how creators distribute products
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.