File tree Expand file tree Collapse file tree 3 files changed +11
-22
lines changed
Expand file tree Collapse file tree 3 files changed +11
-22
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import Loadable from 'react-loadable';
33import { Loading } from 'components/common' ;
44import { fetchTodos } from 'actions/todos' ;
55
6+ // NOTE: To turn off dynamic imports, import this container normally using:
7+ // import TodosContainer from 'containers/Todos';
68const TodosContainer = Loadable ( {
79 loader : ( ) => import ( '../../containers/Todos' ) ,
810 loading : Loading
Original file line number Diff line number Diff line change @@ -103,15 +103,15 @@ export default function handleRender(req, res) {
103103 </ Provider >
104104 ) ;
105105
106- if ( ! config . enableDynamicImports ) {
107- return component ;
106+ if ( config . enableDynamicImports ) {
107+ return (
108+ < Loadable . Capture report = { moduleName => modules . push ( moduleName ) } >
109+ { component }
110+ </ Loadable . Capture >
111+ ) ;
108112 }
109113
110- return (
111- < Loadable . Capture report = { moduleName => modules . push ( moduleName ) } >
112- { component }
113- </ Loadable . Capture >
114- ) ;
114+ return component ;
115115 } ;
116116
117117 // Execute the render only after all promises have been resolved.
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ const entry = [
1818
1919// Additional plugins
2020let plugins = [
21+ ...baseConfig . plugins ,
2122 new webpack . HotModuleReplacementPlugin ( ) ,
2223 new webpack . NoEmitOnErrorsPlugin ( ) ,
2324 new webpack . NamedModulesPlugin ( )
@@ -31,9 +32,6 @@ if (!config.enableDynamicImports) {
3132 } ) ) ;
3233}
3334
34- // Additional loaders
35- const loaders = [ ] ;
36-
3735const webpackConfig = {
3836 ...baseConfig ,
3937 devtool : 'eval' ,
@@ -44,18 +42,7 @@ const webpackConfig = {
4442 ...baseConfig . entry . app
4543 ]
4644 } ,
47- plugins : [
48- // don't use the first plugin (isomorphic plugin)
49- ...baseConfig . plugins ,
50- ...plugins
51- ] ,
52- module : {
53- ...baseConfig . module ,
54- rules : [
55- ...baseConfig . module . rules ,
56- ...loaders
57- ]
58- }
45+ plugins
5946} ;
6047
6148console . info ( 'Firing up Webpack dev server...\n' ) ;
You can’t perform that action at this time.
0 commit comments