question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I use couple of RXJS operators, I have added them in gulpfile.js

      // A list of IDs of modules that should remain external to the bundle
      // See https://github.com/rollup/rollup/wiki/JavaScript-API#external
      external: [
        '@angular/core',
        '@angular/common',
        '@angular/http',
        'rxjs/Observable',
        'rxjs/Subject',
        'rxjs/add/observable/timer',
        'rxjs/add/operator/do',
        'rxjs/add/operator/takeWhile',
        'rxjs/add/operator/switchMap'
      ],

gulp build output:

[02:29:00] Finished 'ngc' after 1.41 s
[02:29:00] Starting 'rollup:fesm'...
build/services/browser-xhr.provider.js (1:17) The 'this' keyword is equivalent to 'undefined' at the to
p level of an ES module, and has been rewritten
build/services/browser-xhr.provider.js (1:25) The 'this' keyword is equivalent to 'undefined' at the to
p level of an ES module, and has been rewritten
[02:29:00] Finished 'rollup:fesm' after 159 ms
[02:29:00] Starting 'rollup:umd'...
build/services/browser-xhr.provider.js (1:17) The 'this' keyword is equivalent to 'undefined' at the to
p level of an ES module, and has been rewritten
build/services/browser-xhr.provider.js (1:25) The 'this' keyword is equivalent to 'undefined' at the to
p level of an ES module, and has been rewritten
No name was provided for external module '@angular/core' in options.globals – guessing '_angular_core'
No name was provided for external module '@angular/common' in options.globals – guessing '_angular_comm
on'
No name was provided for external module 'rxjs/Subject' in options.globals – guessing 'rxjs_Subject'
No name was provided for external module 'rxjs/Observable' in options.globals – guessing 'rxjs_Observab
le'
No name was provided for external module '@angular/http' in options.globals – guessing '_angular_http'
[02:29:00] Finished 'rollup:umd' after 64 ms

I don’t understand why I am getting these errors!

Now when I import the dist package in a new app, I get no errors while compiling, but it is broken at runtime, getting these errors:

image

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

13reactions
sebastianterescommented, Jul 14, 2017

@diego-d5000 I finally found the reference! It was buried in my search history from yesterday 😄
See #126

To give you an example:

My library has 3 components:

  • Component Foo
<p>Component Foo!</p>
  • Component Bar
<p>Component Bar!</p>
  • Component FooBar
<foo></foo>
<bar></bar>

Library module exports component Component FooBar

So my src/index.ts looks like this:

export * from './my-module';
export * from './foo-bar/foo-bar.component';

I believe this will cause the Warnings mentioned in #149 and #126.

So to fix it you would have to edit src/index.ts as follows:

export * from './my-module';
export * from './foo/foo.component';
export * from './bar/bar.component';
export * from './foo-bar/foo-bar.component';

To be honest I didn’t know if this was necessary to begin with but I assumed I could only export what I wanted the library users to use and not to have to export everything. In this case I think is a valid scenario to only want to export fooBar and not foo or bar individually.

To be even more honest I’m not sure what I should be exporting or if I could leave anything out from src/index.tsbut what I did was add an export for every module, component, service or class my library uses internally.

Be that as it may, this fixed both the Warnings and the Runtime error for me.

2reactions
jvandemocommented, Jul 15, 2017

@sebastianteres — Thank you so much for sharing, much appreciated! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Attack On Titan: Eren's 10 Biggest Failures, Ranked - CBR
While Eren technically succeeds in this case, it is an ethical failure of massive proportions. 3/10 He Openly Declares War On The World....
Read more >
Attack On Titan: Eren's Worst Mistakes & Failures - Game Rant
In Attack on Titan, Eren has made plenty of bad decisions. These examples, however, are some of his worst mistakes.
Read more >
Identifying AOT compilation failures - IBM
As with the JIT, first run your application with -Xnoaot, which ensures that the AOT'ed code is not used when running the application....
Read more >
Eren Yeager's 10 biggest failures in Attack on Titan
Here are Eren Yeager's 10 biggest failures and mistakes in Attack on Titan. Using Falco as a pawn comes in Eren's 10 biggest...
Read more >
aot fail sound | TikTok Search
Discover short videos related to aot fail sound on TikTok.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found