diff --git a/src/index.ts b/src/index.ts index 42a77c465..742de0b21 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,7 +6,7 @@ import $ from './utils/cash-dom'; import polyfills from './utils/polyfills'; interface InitEditorConfig extends EditorConfig { - grapesjs?: typeof GrapesJS; + grapesjs?: typeof grapesjs; } polyfills(); @@ -26,13 +26,15 @@ export const usePlugin =
| string>(plugin: P, opts?: P ex }; }; -const GrapesJS = { +export const grapesjs = { $, editors, plugins, + usePlugin, + // @ts-ignore Will be replaced on build version: __GJS_VERSION__, @@ -124,4 +126,4 @@ export type { default as Property } from './style_manager/model/Property'; export type { default as Trait } from './trait_manager/model/Trait'; export type { default as Traits } from './trait_manager/model/Traits'; -export default GrapesJS; +export default grapesjs; diff --git a/webpack.config.js b/webpack.config.js index 168fc1b9b..325182a12 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -9,7 +9,8 @@ export default ({ config }) => ({ output: { ...config.output, filename: 'grapes.min.js', - libraryExport: 'default', + // This will assign all exports to the global object + library: undefined, }, devServer: { ...config.devServer,