Compilation Error with Typescript
Hi Denny, thanks for the report. I'm closing this in favor of #3902 as it should be related (even if the error is different). Please try the new version and let me know if it fixes the issue.
Read full answer below βQuestion
GrapesJS version
- I confirm to use the latest version of GrapesJS
What browser are you using?
Crome 95
Reproducible demo link
none
Describe the bug
How to reproduce the bug?
- Add ts config file
{
"compileOnSave": false,
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": false,
"strictNullChecks": false,
"baseUrl": "./",
"outDir": "./target/generated-typescript",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"skipLibCheck": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true,
"moduleResolution": "Node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"paths": {
"uuid-random": [
"../node_modules/uuid-random"
],
"chroma-js": [
"../node_modules/chroma-js"
],
"faker/locale/en": [
"../node_modules/faker/locale/en"
],
"moment": [
"../node_modules/moment"
],
"validator": [
"../node_modules/validator"
],
"object-hash": [
"../node_modules/object-hash"
]
}
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true
}
}
- Add grapes as dependency
- Import Grapes via
import * as grapesjs from 'grapesjs';and@import "~grapesjs/src/styles/scss/main.scss"; - Build your project
- Get the error
./node_modules/backbone/backbone.js - Error: Module not found: Error: Can't resolve 'jquery' in 'C:\Users\denny\IdeaProjects\WSPone-Platform\frontend\node_modules\backbone'
./node_modules/grapesjs/dist/grapes.min.js - Error: Module not found: Error: Can't resolve 'jquery' in 'C:\Users\denny\IdeaProjects\WSPone-Platform\frontend\node_modules\grapesjs\dist'
What is the expected behavior?
Should build like version .27
What is the current behavior?
So we've recently updated to grapes v17.28. With this particular version we get the error message when building our angular project. It is correct, that we don't have jquery as dependency. But for some reason backbone is requiring it now. The backbone version is still the same as with .27.
As soon as we revert our version to .27 it works totally fine.
The problematic code is
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') {
var _ = require('underscore'), $;
try { $ = require('jquery'); } catch (e) {}
factory(root, exports, _, $);
I saw that this project now has a tsconfig file, so it is compiling differently now? This might cause the issue
Code of Conduct
- I agree to follow this project's Code of Conduct
Answers (3)
Hi Denny, thanks for the report. I'm closing this in favor of #3902 as it should be related (even if the error is different). Please try the new version and let me know if it fixes the issue.
I'm working on a React + Typescript project and i'm having this same error on .28 version
Thanks for reporting this, @denny99.
Security and dependency issues are important. The GrapesJS team actively works on keeping dependencies up-to-date.
For you right now:
- Run
npm audit fixto see available patches - Check for a newer GrapesJS version that may have already addressed this
- If available, test the latest stable release before upgrading
- If the vulnerability is critical,
npm audit fix --forceis an option, but test thoroughly
Understanding the risk:
- Review the specific vulnerability details on GitHub Security Advisories
- Not all high-severity issues affect your code path
- Some vulnerabilities only trigger under specific conditions
Staying current:
- Watch for new GrapesJS releases
- Subscribe to security notifications on the repo
- The team prioritizes security updates in their release cycle
Related Questions and Answers
Continue research with similar issue discussions.
Issue #4496
setStyle
GrapesJS version[X] I confirm to use the latest version of GrapesJSWhat browser are you using? chrome latest versionReproducible demo link...
Issue #6646
Javascript error when I want to add padding
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Chrome & Firefox Reproducible demo link De...
Issue #6318
Unable to use transparent fill in Block media svg
GrapesJS version[X] I confirm to use the latest version of [email protected] when this issue was filedWhat browser are you using? Fir...
Issue #6152
CSS added via custom code persists after custom code component is removed
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? any Reproducible demo link https://grapesj...
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.