grapesjs-blocks-basic icon indicating copy to clipboard operation
grapesjs-blocks-basic copied to clipboard

Blocks basic plugin not loading in React Vite application

Open 0x59d opened this issue 1 year ago • 4 comments
trafficstars

Hi having an issue with loading blocks basic in a React Vite application using:

npm i grapesjs-blocks-basic   The module doesn't load with the error:

Could not find a declaration file for module 'grapesjs-blocks-basic'.

Navigating to the file contains Javascript:

/*! grapesjs-blocks-basic - 0.1.8 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("grapesjs")):"function"==typeof.....

Compared to navigating to plugin grapesjs-preset-webpage: `import { Editor, Plugin } from 'grapesjs';

export type PluginOptions = { /** * Which blocks to add. * @default ['link-block', 'quote', 'text-basic'] */ blocks?: string[]; .....`

I'm able to load and use the following plugins:

  • grapesjs-preset-webpage
  • grapesjs-preset-forms

Is anyone else having issue with this module? This is a core module so any help or workarounds are greatly appreciated.

Thanks

0x59d avatar Aug 15 '24 23:08 0x59d

Update: Got it running it through the CDN for now

0x59d avatar Aug 16 '24 05:08 0x59d

What do you mean by running it through CDN.

alaksandarjesus avatar Sep 30 '24 13:09 alaksandarjesus

Hi having an issue with loading blocks basic in a React Vite application using:

npm i grapesjs-blocks-basic   The module doesn't load with the error:

Could not find a declaration file for module 'grapesjs-blocks-basic'.

Navigating to the file contains Javascript:

/*! grapesjs-blocks-basic - 0.1.8 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("grapesjs")):"function"==typeof.....

Compared to navigating to plugin grapesjs-preset-webpage: `import { Editor, Plugin } from 'grapesjs';

export type PluginOptions = { /** * Which blocks to add. * @default ['link-block', 'quote', 'text-basic'] */ blocks?: string[]; .....`

I'm able to load and use the following plugins:

  • grapesjs-preset-webpage
  • grapesjs-preset-forms

Is anyone else having issue with this module? This is a core module so any help or workarounds are greatly appreciated.

Thanks

Im having the same issue using React / Remix

teknosains avatar Nov 11 '24 13:11 teknosains

Hi having an issue with loading blocks basic in a React Vite application using: npm i grapesjs-blocks-basic   The module doesn't load with the error:

Could not find a declaration file for module 'grapesjs-blocks-basic'.

Navigating to the file contains Javascript: /*! grapesjs-blocks-basic - 0.1.8 */ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("grapesjs")):"function"==typeof..... Compared to navigating to plugin grapesjs-preset-webpage: import { Editor, Plugin } from 'grapesjs'; export type PluginOptions = { /** * Which blocks to add. * @default ['link-block', 'quote', 'text-basic'] */ blocks?: string[]; ..... I'm able to load and use the following plugins:

  • grapesjs-preset-webpage
  • grapesjs-preset-forms

Is anyone else having issue with this module? This is a core module so any help or workarounds are greatly appreciated. Thanks

Im having the same issue using React / Remix

Got it working by appending it along with the webpreset

import gjsPresetWebpage from "grapesjs-preset-webpage"; 
import gjsBlocksBasic from 'grapesjs-blocks-basic';

// ...
grapesjs.init({
  plugins: [gjsPresetWebpage, gjsBlocksBasic],
});

but its not working when like this (loading the plugins alone)

import gjsBlocksBasic from 'grapesjs-blocks-basic';

// ...
grapesjs.init({
  plugins: [gjsBlocksBasic],
});

so it needs to be paired with the gjsPresetWebpage. a bit weird

So my workaround is to hide a Block that's not needed in the gjs-preset-webpage coz its already available in gjs-block-basic. The final setup looks like this

import gjsPresetWebpage from "grapesjs-preset-webpage"; 
import gjsBlocksBasic from 'grapesjs-blocks-basic';

// ...
grapesjs.init({
  plugins: [gjsPresetWebpage, gjsBlocksBasic],
  [gjsPresetWebpage]: {
    blocks: ['quote', 'text-basic']
  }
});

teknosains avatar Nov 11 '24 13:11 teknosains