jvandemo / generator-angular2-library

Yeoman generator to create an Angular library
MIT License
752 stars 122 forks source link

Playground gets into infinite refresh loop on newly generated library #208

Open Kamilius opened 7 years ago

Kamilius commented 7 years ago

Steps to reproduce:

  1. Generate new library with yo angular2-library.
  2. Run npm run playground.

Browser refreshes indefinately.

Tools: NodeJS: v6.10.0 Angular2-library: v11.4.0 OS: MacOSX

Here is a part of an output:

 playground npm run playground

> playground@0.1.0 playground /Users/ohutsulyak/proj/playground
> concurrently "npm run build:watch" "npm run playground:build" "npm run lite"

[0]
[0] > playground@0.1.0 build:watch /Users/ohutsulyak/proj/playground
[0] > gulp
[0]
[1]
[1] > playground@0.1.0 playground:build /Users/ohutsulyak/proj/playground
[1] > tsc -p playground -w
[1]
[2]
[2] > playground@0.1.0 lite /Users/ohutsulyak/proj/playground
[2] > lite-server
[2]
[2] ** browser-sync config **
[2] { injectChanges: false,
[2]   files: [ './**/*.{html,htm,css,js}' ],
[2]   watchOptions: { ignored: 'node_modules' },
[2]   server:
[2]    { baseDir: 'src',
[2]      middleware: [ [Function], [Function] ],
[2]      routes:
[2]       { '/': 'playground',
[2]         '/node_modules/': 'node_modules',
[2]         '/dist/': 'dist',
[2]         '/.playground': '.playground' } } }
[2] [Browsersync] Access URLs:
[2]  ------------------------------------
[2]        Local: http://localhost:3000
[2]     External: http://10.62.96.40:3000
[2]  ------------------------------------
[2]           UI: http://localhost:3001
[2]  UI External: http://10.62.96.40:3001
[2]  ------------------------------------
[2] [Browsersync] Serving files from: src
[2] [Browsersync] Watching files...
[0] [12:16:30]
[0] Using gulpfile ~/proj/playground/gulpfile.js
[0] [12:16:30]
[0] Starting 'clean:dist'...
[0] [12:16:30] Starting 'clean:tmp'...
[0] [12:16:30]
[0] Starting 'clean:build'...
[0] [12:16:30] Starting 'compile'...
[0] [12:16:30]
[0] Starting 'watch'...
[0] [12:16:30]
[0] Finished 'watch' after 25 ms
[0] [12:16:30]
[0] Finished 'compile' after 28 ms
[0] [12:16:30]
[0] Finished 'clean:dist' after 41 ms
[0] [12:16:30] Starting 'copy:source'...
[0] [12:16:30]
[0] Finished 'clean:tmp' after 47 ms
[0] [12:16:30]
[0] Finished 'clean:build' after 45 ms
[0] [12:16:30]
[0] Starting 'clean'...
[0] [12:16:30] Finished 'clean' after 2.17 μs
[0] [12:16:30] Starting 'build'...
[0] [12:16:30] Finished 'build' after 2.47 μs
[0] [12:16:30] Starting 'build:watch'...
[0] [12:16:30] Finished 'build:watch' after 2.33 μs
[0] [12:16:30] Starting 'default'...
[0] [12:16:30] Finished 'default' after 2.46 μs
[0] [12:16:31] Finished 'copy:source' after 62 ms
[0] [12:16:31] Starting 'inline-resources'...
[0] [12:16:31] Finished 'inline-resources' after 20 ms
[0] [12:16:31] Starting 'ngc'...
[2] 17.09.22 12:16:31 200 GET /index.html
[2] 17.09.22 12:16:31 304 GET /core-js/client/shim.min.js
[2] 17.09.22 12:16:31 304 GET /zone.js/dist/zone.js
[2] 17.09.22 12:16:31 304 GET /systemjs/dist/system.src.js
[2] 17.09.22 12:16:31 200 GET /systemjs.config.js
[2] 17.09.22 12:16:31 404 GET /.playground/index.js
[1] playground/index.ts(9,31): error TS2307: Cannot find module 'playground'.
[0] [12:16:32] Finished 'ngc' after 1.6 s
[0] [12:16:32] Starting 'rollup:fesm'...
[1] 12:16:32 PM - Compilation complete. Watching for file changes.
[1]
[1]
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] 17.09.22 12:16:32 304 GET /index.html
[2] 17.09.22 12:16:32 304 GET /core-js/client/shim.min.js
[2] 17.09.22 12:16:32 304 GET /systemjs.config.js
[2] 17.09.22 12:16:32 304 GET /zone.js/dist/zone.js
[2] 17.09.22 12:16:32 304 GET /systemjs/dist/system.src.js
[0] [12:16:32]
[0] Finished 'rollup:fesm' after 185 ms
[0] [12:16:32] Starting 'rollup:umd'...
[2] [Browsersync] Reloading Browsers...
[0] No name was provided for external module '@angular/core' in options.globals – guessing 'core'
[0] No name was provided for external module '@angular/common' in options.globals – guessing 'common'
[0] [12:16:32] Finished 'rollup:umd' after 35 ms
[0] [12:16:32] Starting 'copy:build'...
[0] [12:16:32] Finished 'copy:build' after 9.58 ms
[0] [12:16:32] Starting 'copy:manifest'...
[0] [12:16:32] Finished 'copy:manifest' after 1.66 ms
[0] [12:16:32] Starting 'copy:readme'...
[0] [12:16:32]
[0] Finished 'copy:readme' after 1.59 ms
[0] [12:16:32] Starting 'clean:build'...
[2] 17.09.22 12:16:32 200 GET /index.js
[0] [12:16:32] Finished 'clean:build' after 7.4 ms
[0] [12:16:32] Starting 'clean:tmp'...
[0] [12:16:32]
[0] Finished 'clean:tmp' after 3.92 ms
[0] Compilation finished succesfully
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] 17.09.22 12:16:33 304 GET /@angular/platform-browser/bundles/platform-browser.umd.js
[2] 17.09.22 12:16:33 304 GET /@angular/core/bundles/core.umd.js
[2] 17.09.22 12:16:33 304 GET /@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js
[2] 17.09.22 12:16:33 200 GET /playground.umd.js
[2] 17.09.22 12:16:33 304 GET /@angular/common/bundles/common.umd.js
[2] 17.09.22 12:16:33 304 GET /@angular/compiler/bundles/compiler.umd.js
[2] 17.09.22 12:16:33 304 GET /rxjs/Observable.js
[2] 17.09.22 12:16:33 304 GET /rxjs/observable/merge.js
[2] 17.09.22 12:16:33 304 GET /rxjs/operator/share.js
[2] 17.09.22 12:16:33 304 GET /rxjs/Subject.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/root.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/toSubscriber.js
[2] 17.09.22 12:16:33 304 GET /rxjs/symbol/observable.js
[2] 17.09.22 12:16:33 304 GET /rxjs/operator/merge.js
[2] 17.09.22 12:16:33 304 GET /rxjs/operator/multicast.js
[2] 17.09.22 12:16:33 304 GET /rxjs/Subscriber.js
[2] 17.09.22 12:16:33 304 GET /rxjs/Subscription.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/ObjectUnsubscribedError.js
[2] 17.09.22 12:16:33 304 GET /rxjs/SubjectSubscription.js
[2] 17.09.22 12:16:33 304 GET /rxjs/symbol/rxSubscriber.js
[2] 17.09.22 12:16:33 304 GET /rxjs/Observer.js
[2] 17.09.22 12:16:33 304 GET /rxjs/observable/ArrayObservable.js
[2] 17.09.22 12:16:33 304 GET /rxjs/operator/mergeAll.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/isScheduler.js
[2] 17.09.22 12:16:33 304 GET /rxjs/observable/ConnectableObservable.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/isFunction.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/isArray.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/isObject.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/tryCatch.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/errorObject.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/UnsubscriptionError.js
[2] 17.09.22 12:16:33 304 GET /rxjs/observable/ScalarObservable.js
[2] 17.09.22 12:16:33 304 GET /rxjs/observable/EmptyObservable.js
[2] 17.09.22 12:16:33 304 GET /rxjs/OuterSubscriber.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/subscribeToResult.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/isArrayLike.js
[2] 17.09.22 12:16:33 304 GET /rxjs/util/isPromise.js
[2] 17.09.22 12:16:33 304 GET /rxjs/symbol/iterator.js
[2] 17.09.22 12:16:33 304 GET /rxjs/InnerSubscriber.js
[0] [12:16:34] Starting 'compile'...
[0] [12:16:34] Starting 'clean:dist'...
[0] [12:16:34] Finished 'compile' after 725 μs
[0] [12:16:34]
[0] Starting 'compile'...
[0] [12:16:34] Finished 'compile' after 87 μs
[0] [12:16:34] Starting 'compile'...
[0] [12:16:34] Finished 'compile' after 81 μs
[0] [12:16:34] Starting 'compile'...
[0] [12:16:34] Finished 'compile' after 79 μs
[0] [12:16:34] Starting 'compile'...
[0] [12:16:34] Finished 'compile' after 77 μs
[0] [12:16:34] Starting 'compile'...
[0] [12:16:34] Finished 'compile' after 77 μs
[0] [12:16:34] Finished 'clean:dist' after 7.38 ms
[0] [12:16:34] Starting 'copy:source'...
[0] [12:16:34]
[0] Finished 'copy:source' after 15 ms
[0] [12:16:34] Starting 'inline-resources'...
[0] [12:16:34]
[0] Finished 'inline-resources' after 2 ms
[0] [12:16:34] Starting 'ngc'...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] [Browsersync] Reloading Browsers...
[2] 17.09.22 12:16:34 304 GET /index.html
[2] 17.09.22 12:16:34 200 GET /index.html
[2] 17.09.22 12:16:34 304 GET /core-js/client/shim.min.js
[2] 17.09.22 12:16:34 304 GET /zone.js/dist/zone.js
[2] 17.09.22 12:16:34 304 GET /systemjs/dist/system.src.js
[2] 17.09.22 12:16:34 304 GET /systemjs.config.js
[2] 17.09.22 12:16:34 304 GET /index.js
[2] 17.09.22 12:16:34 304 GET /@angular/platform-browser/bundles/platform-browser.umd.js
[2] 17.09.22 12:16:34 304 GET /@angular/core/bundles/core.umd.js
[2] 17.09.22 12:16:34 304 GET /@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js
[2] 17.09.22 12:16:34 404 GET /dist/playground.umd.js
[0] [12:16:35]
[0] Finished 'ngc' after 1 s
[0] [12:16:35] Starting 'rollup:fesm'...
Kamilius commented 7 years ago

Update, it's actually a gulp build:watch which causes an infinite loop. Tried running it separately, and got following output:

example-lib gulp build:watch
[12:31:07] Using gulpfile ~/proj/example-lib/gulpfile.js
[12:31:07] Starting 'clean:dist'...
[12:31:07] Starting 'clean:tmp'...
[12:31:07] Starting 'clean:build'...
[12:31:07] Starting 'compile'...
[12:31:07] Starting 'watch'...
[12:31:07] Finished 'watch' after 16 ms
[12:31:07] Finished 'compile' after 18 ms
[12:31:07] Finished 'clean:tmp' after 25 ms
[12:31:07] Finished 'clean:build' after 24 ms
[12:31:07] Finished 'clean:dist' after 35 ms
[12:31:07] Starting 'copy:source'...
[12:31:07] Starting 'clean'...
[12:31:07] Finished 'clean' after 1.64 μs
[12:31:07] Starting 'build'...
[12:31:07] Finished 'build' after 1.73 μs
[12:31:07] Starting 'build:watch'...
[12:31:07] Finished 'build:watch' after 1.45 μs
[12:31:07] Finished 'copy:source' after 31 ms
[12:31:07] Starting 'inline-resources'...
[12:31:07] Finished 'inline-resources' after 8.27 ms
[12:31:07] Starting 'ngc'...
[12:31:08] Finished 'ngc' after 1.23 s
[12:31:08] Starting 'rollup:fesm'...
[12:31:08] Finished 'rollup:fesm' after 170 ms
[12:31:08] Starting 'rollup:umd'...
No name was provided for external module '@angular/core' in options.globals – guessing 'core'
No name was provided for external module '@angular/common' in options.globals – guessing 'common'
[12:31:08] Finished 'rollup:umd' after 31 ms
[12:31:08] Starting 'copy:build'...
[12:31:08] Finished 'copy:build' after 13 ms
[12:31:08] Starting 'copy:manifest'...
[12:31:08] Finished 'copy:manifest' after 2.84 ms
[12:31:08] Starting 'copy:readme'...
[12:31:08] Finished 'copy:readme' after 1.71 ms
[12:31:08] Starting 'clean:build'...
[12:31:08] Finished 'clean:build' after 3.32 ms
[12:31:08] Starting 'clean:tmp'...
[12:31:08] Finished 'clean:tmp' after 2.22 ms
Compilation finished succesfully
[12:31:09] Starting 'compile'...
[12:31:09] Starting 'clean:dist'...
[12:31:09] Finished 'compile' after 716 μs
[12:31:09] Starting 'compile'...
[12:31:09] Finished 'compile' after 91 μs
[12:31:09] Starting 'compile'...
[12:31:09] Finished 'compile' after 83 μs
[12:31:09] Starting 'compile'...
[12:31:09] Finished 'compile' after 101 μs
[12:31:09] Starting 'compile'...
[12:31:09] Finished 'compile' after 147 μs
[12:31:09] Finished 'clean:dist' after 6.11 ms
[12:31:09] Starting 'copy:source'...
[12:31:09] Finished 'copy:source' after 13 ms
[12:31:09] Starting 'inline-resources'...
[12:31:09] Finished 'inline-resources' after 1.85 ms
[12:31:09] Starting 'ngc'...
[12:31:10] Finished 'ngc' after 895 ms
[12:31:10] Starting 'rollup:fesm'...
[12:31:10] Starting 'compile'...
[12:31:10] Starting 'clean:dist'...
[12:31:10] Finished 'compile' after 423 μs
[12:31:10] Finished 'clean:dist' after 1.25 ms
[12:31:10] Starting 'copy:source'...
[12:31:10] Finished 'rollup:fesm' after 34 ms
[12:31:10] Starting 'rollup:umd'...
No name was provided for external module '@angular/core' in options.globals – guessing 'core'
No name was provided for external module '@angular/common' in options.globals – guessing 'common'
[12:31:10] Finished 'rollup:umd' after 28 ms
[12:31:10] Starting 'copy:build'...
[12:31:10] Finished 'copy:build' after 12 ms
[12:31:10] Starting 'copy:manifest'...
[12:31:10] Finished 'copy:source' after 70 ms
[12:31:10] Starting 'inline-resources'...
[12:31:10] Finished 'inline-resources' after 3.41 ms
[12:31:10] Starting 'ngc'...
[12:31:11] Finished 'ngc' after 889 ms
[12:31:11] Starting 'rollup:fesm'...
[12:31:11] Finished 'copy:manifest' after 898 ms
[12:31:11] Starting 'copy:readme'...
[12:31:11] Finished 'copy:readme' after 1.6 ms
[12:31:11] Starting 'clean:build'...
[12:31:11] Finished 'clean:build' after 21 ms
[12:31:11] Starting 'clean:tmp'...
[12:31:11] Finished 'rollup:fesm' after 27 ms
[12:31:11] Starting 'rollup:umd'...

events.js:160
      throw er; // Unhandled 'error' event
      ^
Error: Could not resolve entry (/Users/ohutsulyak/proj/example-lib/build/index.js)
    at error (/Users/ohutsulyak/proj/example-lib/node_modules/rollup/dist/rollup.js:185:14)
    at resolveId.then.id (/Users/ohutsulyak/proj/example-lib/node_modules/rollup/dist/rollup.js:9551:6)
    at process._tickCallback (internal/process/next_tick.js:103:7)
izifortune commented 7 years ago

Thanks @Kamilius I'll have a look into it

jvandemo commented 7 years ago

@Kamilius — Thank you for reporting.

@izifortune — Thank you for looking into it 👍

izifortune commented 7 years ago

I've spent some times here but i still can't reproduce the problem, plus from the error it seems related to gulp build:watch rather than the playground itself

jvandemo commented 7 years ago

Haven't been able to reproduce this either.

@Kamilius — Were you able to fix this yet? Thanks!