Created
September 26, 2019 09:49
-
-
Save marekalgoud/68ab9b03ce8bfddb2575f4e5640b0695 to your computer and use it in GitHub Desktop.
dynamic lazyloading with webpack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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