I\'m new to webpack and right now I\'m using it for the first time in one of my angular projects.
I want to use the require function in my html file in order to requ
I've already posted this on https://stackoverflow.com/a/34815472/833093 but:
To enable you must to configure the "relativeTo" parameter, otherwise your template partials get loaded at "/home/username/path/to/project/path/to/template/" (Check your bundle.js you're probably leaking your username in your projects)
var ngTemplateLoader = (
'ngtemplate?relativeTo=' + path.resolve(__dirname, './src/') +
'!html'
);
module.exports = {
...
module: {
loaders: [
{test: /\.html$/, loader: ngTemplateLoader},
],
},
...
}
Then in your code, do a side-effect only require:
// src/webapp/admin/js/foo.js
require('../../templates/path/to/template.html');
Then you can load the html: