Answer the question
In order to leave comments, you need to log in
Why doesn't the webpack plugin for html templat injection work?
Good day everyone! Faced the following problem, there is a code:
import template from './app.html';
let app = angular.module('app', []);
app.component('app', {
templateUrl: 'template',
controller: ['$http',App],
controllerAs: '$app'
});
ERROR in Cannot find module './node_modules/ng-cache-loader/index.js'
@ ./src/app.js 7:11-32
ERROR in ReferenceError: window is not defined
test: /\.html$/,
loader: "ng-cache?prefix=[dir]/[dir]"
test: /\.html$/,
loader: 'ngtemplate?relativeTo=' + (path.resolve(__dirname, './app')) + '/!html'
ERROR in Error: Child compilation failed:
Entry module not found: Error: Cannot resolve module 'html' in D:\Proj\AllProjects\Unicorn_Test_Angular:
Error: Cannot resolve module 'html' in D:\Proj\AllProjects\Unicorn_Test_Angular
Answer the question
In order to leave comments, you need to log in
Why not just use html-loader?
{
test: /\.html$/,
loader: "html"
}
template: require('./page.template.html')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question