ngtemplate-loader
ngtemplate-loader copied to clipboard
relativeTo parameter is not working
Hi,
I'm a bit confused by this loader, I'll try to set up a very straightforward config where all my HTML files are located into a templates folder (see the folder structure below). Thus if I have correctly understood the way this module works, I defined the following config:
webpack.config.js
{
test: /\.html$/,
use: [
{
loader: 'ngtemplate-loader?relativeTo=' + (path.resolve(__dirname, '../templates')),
}
]
}
Folder structure
.
├── app
├── templates
└── ...
When I try to require my templates/root.html
from my angular entry point app/main.js
with the following command:
const rootTpl = require('root.html');
I get the following error:
ERROR in ./app/main.js
Module not found: Error: Can't resolve 'root.html' in '[__dirname]/app'
I don't understand why it tries to resolve the path of my root.html
from /app
instead of /templates
.
Any idea about what is wrong with my configuration? Maybe I'm missing something obvious.
I'm using angular 1.5.11, webpack 3.10.0 and ngtemplate-loader 2.0.1.
require('./root.html')
maybe?