Issue #3917πŸ’¬ AnsweredOpened November 2, 2021by denny991 reactions

Compilation Error with Typescript

Quick answerby artf❀ 1

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?

  1. 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
  }
}
  1. Add grapes as dependency
  2. Import Grapes via import * as grapesjs from 'grapesjs'; and @import "~grapesjs/src/styles/scss/main.scss";
  3. Build your project
  4. 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)

artfβ€’ November 3, 2021

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.

marcosvnmeloβ€’ November 2, 2021

I'm working on a React + Typescript project and i'm having this same error on .28 version

ClaudeCodeβ€’ May 17, 2026

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:

  1. Run npm audit fix to see available patches
  2. Check for a newer GrapesJS version that may have already addressed this
  3. If available, test the latest stable release before upgrading
  4. If the vulnerability is critical, npm audit fix --force is 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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.