jhamm
jhamm

Reputation: 25062

How to disable ng-template-loader from looking at image src's?

I am starting to use webpack as my build tool for an angular project. I am having to pull in ng-template-loader to create my templateCache. Here is my webpack config:

{
  test: /\.html$/,
  loader: 'ngtemplate!html'
}

And now I can import my html files like this

var template = require('./menu.html');

This works fine, but in my html, I have an <img /> with a src that points to a source that doesn't exist in my dev environment. It keeps breaking, saying

Module not found: Error: Cannot resolve 'file' or 'directory'

How do I get around this, or disable it so I can build my project?

Any ideas?

Upvotes: 0

Views: 344

Answers (1)

Mark
Mark

Reputation: 6081

ngtemplate-loader uses html-loader so you can pass the attrs property in as follows, in order to disable default attribute handling:

{
    test: /\.html$/,
    loader: 'ngtemplate!html?attrs=false'
}

Upvotes: 1

Related Questions