Replaces every "templateUrl: 'url'," in code with "template: require(./url)". It's allows You to bundle external directives and components which are not webpack ready (like AngularStrap)
To use template-url-loader You can either declare it in webpack.config.js:
loaders: [
{ test: /\.js$/, loader: "template-url-loader" },
]},
or in import statement:
import package from 'template-url-loader!path/package.js';
//package contains Angular module declaring templateUrl.
###Passing path prefix
Paths declared as templateUrl may differ from relative path from declaring module to template file. To create proper require statement, You can pass path prefix as argument, as follows:
require("template-url-loader?../prefix/path!path/package.js");
//string between '?' and '!' ('../prefix/path') is prefix added to every replaced templateUrl in file.
You can find working example here