Skip to content

Instantly share code, notes, and snippets.

@stephan-v
Last active July 31, 2017 14:25
Show Gist options
  • Save stephan-v/dd1106bd600041e573b9485e825b63b0 to your computer and use it in GitHub Desktop.
Save stephan-v/dd1106bd600041e573b9485e825b63b0 to your computer and use it in GitHub Desktop.
Code splitting SVG images with Webpack.
import(/* webpackChunkName: "js/svg/[request]" */ `resources/assets/images/svg/${this.name}.svg`)
.then((module) => {
this.svg = module;
}
).catch(error => 'An error occured while loading the svg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment