GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

[Question] Loading from package in TypeScript giving undefined error. #1337

Closed mgebeily closed 6 years ago

mgebeily commented 6 years ago

Similar to issue #902 but I can't seem to resolve with the steps taken in that discussion.

I'm using the latest version of Angular, Webpack, and TypeScript.

I'm able to get the editor itself up fine. However, when I try to import grapesjs-preset-newsletter, I'm getting grapesjs is not defined. My imports look like this:

import grapesjs from "grapesjs";
import grapesjsNewsletters from "grapesjs-preset-newsletter";

Then, in ngOnInit, I'm calling:

grapesjs.init({
  container: '#grapes-editor',
  plugins: ['gjs-preset-newsletter'],
})

This doesn't load the preset. The interesting thing is if I have grapesjsNewsletters anywhere in my code, I get grapesjs is not defined.

Am I missing something blatant about how webpack or TypeScript imports work with grapesjs presets?

Thank you for your help in advance. Your library has been excellent to work with.

artf commented 6 years ago

It's happening just because grapesjs-preset-newsletter uses an old way of loading the plugin, I'll fix it soon

devexcelsior commented 5 years ago

Im having the same issue, was this ever resolved?

lock[bot] commented 4 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.