Skip to content

Instantly share code, notes, and snippets.

@charisTheo
Created August 21, 2021 19:15
Show Gist options
  • Select an option

  • Save charisTheo/4336b1d865bb921f02aaed690e3321fc to your computer and use it in GitHub Desktop.

Select an option

Save charisTheo/4336b1d865bb921f02aaed690e3321fc to your computer and use it in GitHub Desktop.
const LoadablePlugin = require('@loadable/webpack-plugin')
exports.onCreateWebpackConfig = ({ actions, plugins }) => {
actions.setWebpackConfig({
plugins: [new LoadablePlugin()]
})
}
import loadable from '@loadable/component'
export default function Page(props) {
const LazyComponent = loadable(() => import(`../components/lazyComponent.js`))
return (
<Layout>
// ...
<LazyComponent whatAmI={"Lazy!"} />
</Layout>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment