Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relativeTo parameter is not working #77

Open
Airboy opened this issue Jan 17, 2018 · 1 comment
Open

relativeTo parameter is not working #77

Airboy opened this issue Jan 17, 2018 · 1 comment

Comments

@Airboy
Copy link

Airboy commented Jan 17, 2018

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.

@stevenvachon
Copy link

require('./root.html') maybe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants