Browse Source

Fix `usePlugin is not a function`. Closes #5167

pull/5196/head
Artur Arseniev 3 years ago
parent
commit
e3cacfd7d0
  1. 8
      src/index.ts
  2. 3
      webpack.config.js

8
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 = <P extends Plugin<any> | 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;

3
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,

Loading…
Cancel
Save