kopia lustrzana https://github.com/wagtail/wagtail
Change Draftail import paths so code is properly split by Webpack
rodzic
61a57b6691
commit
db33741d25
|
@ -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,
|
||||
};
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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;
|
||||
|
|
Ładowanie…
Reference in New Issue