You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Maybe I'm going about it the wrong way, but I'm trying to convert a javascript project with Angular 1.x to WebPack and TypeScript. I got it mostly working, but I'm running into trouble when ts-loader seems to be optimizing my scripts out of the bundle when the exports are not directly used.
Here's a sample project demonstrating the issue (npm install, webpack, then load index.html). The logging from ClassA is showing up, but angular is reporting ClassB missing (provider). If you look in bundle.js you'll notice ClassB missing entirely.
The difference is ClassA begin use directly after importing, and ClassB is only referenced by type for compilation.
Is there a way to force ClassB to be included? Or am I going about it wrong? Angular 2 would probably solve this issue, but that's a step too large right now.
The text was updated successfully, but these errors were encountered:
Thanks, I have a work around now. But it's not a pretty one (duplicate imports essentially).
I might use the preprocessor-loader to add an extra require for every typescript import it encounters. I'll give it a play and if it works, I'll report back.
I got it working using preprocessor that automatically insert require statements for import statements. My bundle is now produced properly without directly editing the source file.
The regex is rather limited however and needs some work to make it robust, but in concept it works.
Maybe I'm going about it the wrong way, but I'm trying to convert a javascript project with Angular 1.x to WebPack and TypeScript. I got it mostly working, but I'm running into trouble when ts-loader seems to be optimizing my scripts out of the bundle when the exports are not directly used.
Here's a sample project demonstrating the issue (npm install, webpack, then load index.html). The logging from ClassA is showing up, but angular is reporting ClassB missing (provider). If you look in bundle.js you'll notice ClassB missing entirely.
https://github.com/bbottema/webpack-typescript
The difference is ClassA begin use directly after importing, and ClassB is only referenced by type for compilation.
Is there a way to force ClassB to be included? Or am I going about it wrong? Angular 2 would probably solve this issue, but that's a step too large right now.
The text was updated successfully, but these errors were encountered: