Issue #2721💬 AnsweredOpened April 17, 2020by alex19891 reactions

Can not import any locale file from grapesjs/locale/

快速解答by padcom1

With the change provided by PR #6459 it is now possible to do the following: Make sure you also load the styles correctly:

Read full answer below ↓

Question

Hi I run into an error when I'm trying to import any locale file from 'grapejs/locale' by using es6 import

I followed by the documentation:

https://grapesjs.com/docs/modules/I18n.html#configuration

but I always get this: image

I can import it only in next way image

Could you explain why I can't import it directly from grapesjs/locale/.

grapejs was installed by npm install

grapejs is latest version (0.16.3)

Answers (3)

padcomMarch 21, 2025

With the change provided by PR #6459 it is now possible to do the following:

  <script type="importmap">
    {
      "imports": {
        "grapesjs": "https://unpkg.com/grapesjs/dist/grapes.mjs",
        "grapesjs/locale/en": "https://unpkg.com/grapesjs/locale/en.mjs",
        "grapesjs/locale/pt": "https://unpkg.com/grapesjs/locale/pt.mjs",
      }
    }
  </script>

Make sure you also load the styles correctly:

  <link rel="stylesheet" href="https://unpkg.com/grapesjs/dist/css/grapes.min.css">
willGabrielPereiraJanuary 30, 2023

It still don't works, only works from "src/i18n/locale/...." Using v0.20.3

image

image

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.