button.innerHTML = 'Click me and look at the console!'; element.innerHTML = _.join(['Hello', 'webpack'], ' '); element.appendChild(br); element.appendChild(button);
// Note that because a network request is involved, some indication // of loading would need to be shown in a production-level site/app. button.onclick = (e) => import(/* webpackChunkName: "print" */'./print').then((module) => { const print = module.default; print(); });
return element; }
document.body.appendChild(component());
learn_webpack/print.js
1 2 3 4 5 6 7
console.log( 'The print.js module has loaded! See the network tab in dev tools...' );