You can make a second step, and load it when its needed (or not load when its not needed - i assume not every page needs it).
Simplified example for prism.js:
if ($q('code[class*="language-"]')) { import(/* webpackChunkName: "syntaxHighlighting" */ './js/syntaxHighlighting'); }
Notes:
const dynamicImport = p => import(`modules/${p}`).then(m => m.default())
And then call it from your js, when something happens.
If dev.to wasnt so heavy into react i could do some good with my webpack knowledge, but i dont want to get dirty with all the abstractions in there ;)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can make a second step, and load it when its needed (or not load when its not needed - i assume not every page needs it).
Simplified example for prism.js:
Notes:
And then call it from your js, when something happens.
If dev.to wasnt so heavy into react i could do some good with my webpack knowledge, but i dont want to get dirty with all the abstractions in there ;)