diff --git a/client/src/index.js b/client/src/index.js index ca4a3d41aa..9cc7b02821 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -12,7 +12,6 @@ import Explorer, { ExplorerToggle, initExplorer, } from './components/Explorer'; -import draftail from './components/Draftail'; export { Button, @@ -23,5 +22,4 @@ export { Explorer, ExplorerToggle, initExplorer, - draftail, }; diff --git a/client/webpack/base.config.js b/client/webpack/base.config.js index 8d8c45134d..551ab3078b 100644 --- a/client/webpack/base.config.js +++ b/client/webpack/base.config.js @@ -6,18 +6,14 @@ const getEntryPath = (app, filename) => path.resolve('wagtail', app, 'static_src // Generates a path to the output bundle to be loaded in the browser. const getOutputPath = (app, filename) => path.join('wagtail', app, 'static', `wagtail${app}`, 'js', filename); -const isVendorModule = (module) => { - const res = module.resource; - return res && res.indexOf('node_modules') >= 0 && res.match(/\.js$/); -}; - // Mapping from package name to exposed global variable. const exposedDependencies = { 'focus-trap-react': 'FocusTrapReact', 'react': 'React', 'react-dom': 'ReactDOM', 'react-transition-group/CSSTransitionGroup': 'CSSTransitionGroup', -} + 'draft-js': 'DraftJS', +}; module.exports = function exports() { const entry = { @@ -41,7 +37,7 @@ module.exports = function exports() { new webpack.optimize.CommonsChunkPlugin({ name: 'vendor', filename: getOutputPath('admin', '[name].js'), - minChunks: isVendorModule, + minChunks: 2, }), ], resolve: { diff --git a/wagtail/admin/static_src/wagtailadmin/app/draftail.entry.js b/wagtail/admin/static_src/wagtailadmin/app/draftail.entry.js index 161d6c5cfc..a0d38a33e9 100644 --- a/wagtail/admin/static_src/wagtailadmin/app/draftail.entry.js +++ b/wagtail/admin/static_src/wagtailadmin/app/draftail.entry.js @@ -1,4 +1,4 @@ -import { draftail } from 'wagtail-client'; +import draftail from '../../../../../client/src/components/Draftail'; // Expose as a global variable, for integration with other scripts. window.draftail = draftail;