diff --git a/examples/with-dynamic-import/next.config.js b/examples/with-dynamic-import/next.config.js index 919b7305071f0..b12eae1832904 100644 --- a/examples/with-dynamic-import/next.config.js +++ b/examples/with-dynamic-import/next.config.js @@ -1,7 +1,7 @@ module.exports = { exportPathMap: function () { return { - '/': { page: '/' }, + '/': { page: '/', query: { showMore: false } }, '/about': { page: '/about' } } } diff --git a/examples/with-dynamic-import/pages/index.js b/examples/with-dynamic-import/pages/index.js index 6e4a9a0165e3b..7af408fb3e2e3 100644 --- a/examples/with-dynamic-import/pages/index.js +++ b/examples/with-dynamic-import/pages/index.js @@ -4,35 +4,39 @@ import Header from '../components/Header' import Counter from '../components/Counter' import dynamic from 'next/dynamic' -const DynamicComponent = dynamic(import('../components/hello1')) -const DynamicComponentWithCustomLoading = dynamic( - import('../components/hello2'), - { - loading: () => (
...
) - } -) -const DynamicComponentWithNoSSR = dynamic( - import('../components/hello3'), - { ssr: false } -) -const DynamicComponent5 = dynamic(import('../components/hello5')) +const DynamicComponent1 = dynamic(import('../components/hello1')) + +const DynamicComponent2WithCustomLoading = dynamic({ + loader: () => import('../components/hello2'), + loading: () => (Loading caused by client page transition ...
) +}) + +const DynamicComponent3WithNoSSR = dynamic({ + loader: () => import('../components/hello3'), + loading: () => (Loading ...
), + ssr: false +}) + +const DynamicComponent4 = dynamic({ + loader: () => import('../components/hello4') +}) + +const DynamicComponent5 = dynamic({ + loader: () => import('../components/hello5') +}) const DynamicBundle = dynamic({ - modules: (props) => { + modules: () => { const components = { - Hello6: import('../components/hello6') + Hello6: import('../components/hello6'), + Hello7: import('../components/hello7') } - - if (props.showMore) { - components.Hello7 = import('../components/hello7') - } - return components }, render: (props, { Hello6, Hello7 }) => (HOME PAGE is here!