Skip to content

Instantly share code, notes, and snippets.

@marekalgoud
Created September 26, 2019 09:49
Show Gist options
  • Save marekalgoud/68ab9b03ce8bfddb2575f4e5640b0695 to your computer and use it in GitHub Desktop.
Save marekalgoud/68ab9b03ce8bfddb2575f4e5640b0695 to your computer and use it in GitHub Desktop.
dynamic lazyloading with webpack
import(/* webpackChunkName: "[request]" */ `./pages/${className}`).then(module => {
try {
const DynamicClass = module.default
const page = new DynamicClass()
page.init()
} catch (err) {
console.error(err)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment