TheLarkInn / angular2-template-loader

Chain-to loader for webpack that inlines all html and style's in angular2 components.
MIT License
205 stars 70 forks source link

declaration: true #19

Open nikolasleblanc opened 8 years ago

nikolasleblanc commented 8 years ago

Hey @TheLarkInn, trying to make a core component library in angular 2 that I can then bundle with webpack + awesome-typescript-loader + angular2-template-loader.

Because I'll be using this library in other angular2 projects, I need d.ts files, but for some reason, if I set declaration: true, angular2-template-loader stops doing its thing and my bundle keeps its templateUrls.

I've set useWebpackText: true.

TheLarkInn commented 8 years ago

This sounds like an issue with awesome-typescript-loader. My guess is that the loader does not use webpack's module resolution or loader chain and instead falls back to the default tsc. Does this sound right @s-panferov?

tekix commented 8 years ago

moving angular2-template-loader before awesome-typescript-loader works for me when declaration:true

{
  test: /\.ts$/,
  loaders: ['angular2-template-loader', 'awesome-typescript-loader'],
  exclude: [/\.(spec|e2e)\.ts$/]
},
nikolasleblanc commented 8 years ago

Wow, really? @TheLarkInn, does that even make sense? :)

On Tue, Nov 8, 2016 at 10:33 AM ryan notifications@github.com wrote:

moving angular2-template-loader before awesome-typescript-loader works for me when declaration:true

{ test: /.ts$/, loaders: ['angular2-template-loader', 'awesome-typescript-loader'], exclude: [/.(spec|e2e).ts$/] },

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TheLarkInn/angular2-template-loader/issues/19#issuecomment-259168866, or mute the thread https://github.com/notifications/unsubscribe-auth/AB2ter4RSQZq-Z3nal55AQcH2Au62WZfks5q8JZdgaJpZM4Jqbbj .

VivekPMenon commented 7 years ago

I have a similar situation. Creating an npm package for core components and distributing .js,.d.ts,html in my package along with the umd bundle. However when Consumer apps run webpack, it doesn't changes templateUrls of my core components to require statements obviously because these are .js files. I tried to chain angular2-template-loader with script-loader but no success.

Is there something i can do it to get it working or is there any fundamental issue in the way i am doing it. Any help would be really appreciated.