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

Cannot use ES6 modules and TypeScript #63

Open
eekboom opened this issue Jul 4, 2017 · 3 comments
Open

Cannot use ES6 modules and TypeScript #63

eekboom opened this issue Jul 4, 2017 · 3 comments

Comments

@eekboom
Copy link

eekboom commented Jul 4, 2017

I have tried a lot of different configuration settings to be able to load my templates like so:

import myTemplateUrl from './hello-angular2-template.thtml';
angular
    .module('pd')
    .component('helloAngular2', {
        templateUrl: myTemplateUrl,
    });

However either all I get from the template import is either "undefined" or an error:

    ERROR in ./src/components/hello-angular2/hello-angular2-template.thtml
    Module parse failed: /home/sfriedrich/dev/ng-webpack/node_modules/ngtemplate-loader/index.js!/home/sfriedrich/dev/ng-webpack/node_modules/html-loader/index.js??ref--0-1!/home/sfriedrich/dev/ng-webpack/src/components/hello-angular2/hello-angular2-template.thtml Unexpected token (2:11)
    You may need an appropriate loader to handle this file type.
    | var path = '/home/sfriedrich/dev/ng-webpack/src/components/hello-angular2/hello-angular2-template.thtml';
    | var html = export default "<div>Angular, from templateURL!</div>";;
    | window.angular.module('ng').run(['$templateCache', function(c) { c.put(path, html) }]);
    | module.exports = path;
     @ ./src/components/hello-angular2/hello-angular2-component.ts 5:38-80
     @ ./src/index.ts
     @ multi (webpack)-dev-server/client?http://localhost:8375 ./src/index.ts

See example project at https://github.com/eekboom/ng-webpack (and also the stackoverflow question at https://stackoverflow.com/questions/44889493/ ).

@mribichich
Copy link

is there any news about this? thanks

@mikila85
Copy link

+1

@lamuertepeluda
Copy link

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

4 participants