WebPack - Building for Performance with Webpack







# vi src/index.js
const button = document.createElement('button');
button.innerText = 'Click me';
button.onclick = () => {
System.import('./image_viewer').then(module => {
// console.log(module);
module.default();
});
};
document.body.appendChild(button);
# vi src/image_viewer.js
import small from '../assets/small.jpg';
import '../styles/image_viewer.css';
export default () => {
const image = document.createElement('img');
image.src = small;
document.body.appendChild(image);
};
# npm run build