kirjs / ng2-codelab

Apache License 2.0
54 stars 27 forks source link

Moved exercises into src directory #63

Closed prestonvanloon closed 7 years ago

prestonvanloon commented 7 years ago

These exercises were outside of the src folder and this made it difficult to write/run new tests in this directory.

kirjs commented 7 years ago

Try building it, and see if it succeeds. Angular-cli had issues with 2 app-modules in the folder or something

prestonvanloon commented 7 years ago

It builds and runs fine with 1.0.0-rc.2

prestonvanloon commented 7 years ago

At least with npm start. Is there some thing else you were referring to?

kirjs commented 7 years ago

Try ng build --prod --aot

prestonvanloon commented 7 years ago

Seems normal

$ ng build --prod --aot
Your global Angular CLI version (1.0.0-rc.4) is greater than your local
version (1.0.0-rc.2). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Hash: 3e216140d53b8bbf804d
Time: 41832ms
chunk    {0} main.13ca412f9a3088e1e8de.bundle.js (main) 3.25 MB {2} [initial] [rendered]
chunk    {1} styles.c4e28cee3ec56fdc77d0.bundle.css (styles) 69 bytes {3} [initial] [rendered]
chunk    {2} vendor.8837d27830744dc0bb1a.bundle.js (vendor) 6.13 MB [initial] [rendered]
chunk    {3} inline.cb120dac268c92070c35.bundle.js (inline) 0 bytes [entry] [rendered]
prestonvanloon commented 7 years ago

@kirjs getting merge conflicts from leaving this out for a while. Can I merge?

kirjs commented 7 years ago

Hm, it failed for me locally when I tried to build it, let me try one more time

aziz512 commented 7 years ago

ng serve works fine, however it does not build for me either. Here's what I get when I run ng build --prod --aot :

$ ng build --prod --aot
Your global Angular CLI version (1.0.0-rc.1) is greater than your local
version (1.0.0-beta.32.3). The local Angular CLI version is used.

To disable this warning use "ng set --global warnings.versionMismatch=false".
Hash: 538ad22790a2b9f56326
Time: 11902ms
chunk    {0} main.83a68263fb6c28a2b8a3.bundle.js (main) 37.7 kB {2} [initial] [rendered]
chunk    {1} styles.c4e28cee3ec56fdc77d0.bundle.css (styles) 69 bytes {3} [initial] [rendered]
chunk    {2} vendor.d3979d840a68052a88e2.bundle.js (vendor) 1.06 MB [initial] [rendered]
chunk    {3} inline.75b0f094021ffa5b91af.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in Type ThumbsComponent in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/thumbs/thumbs.component.ts is part of the declarations of 2 modules: AppModule in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/app.module.ts and AppModule in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/thumbs.app.module.ts! Please consider moving ThumbsComponent in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/thumbs/thumbs.component.ts to a higher module that imports AppModule in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/app.module.ts and AppModule in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/thumbs.app.module.ts. You can also create a new NgModule that exports and includes ThumbsComponent in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/thumbs/thumbs.component.ts then import that NgModule in AppModule in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/app.module.ts and AppModule in C:/My_Data/Code/ng2-codelab/src/exercises/ng2ts/thumbs.app.module.ts.

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'C:\My_Data\Code\ng2-codelab\src'
 @ ./src/main.ts 6:0-74
 @ multi ./src/main.ts
kirjs commented 7 years ago

Getting the same error, weird stuff

prestonvanloon commented 7 years ago

Can you check out this branch into a clean folder? I'm having no issues building it.

prestonvanloon commented 7 years ago

@aziz512, you have an older local angular CLI. I am thinking there won't be errors in a pristine copy of this branch.

prestonvanloon commented 7 years ago

Angular CLI v1 came out a few days ago so building the project is broken for all branches with fresh node_modules.

You seem to not be dependending on "@angular/core". This is an error.

I was trying to "prove" I could build this with an unbiased Dockerfile and that's how I found the error.

FROM node:7

RUN npm i -g @angular/cli

RUN git clone https://github.com/kirjs/ng2-codelab
WORKDIR ng2-codelab

# Checkout branch for PR  63
RUN git checkout feature/refactor-move-exercises

RUN npm i

RUN ng build --prod --aot

ENTRYPOINT echo "success"

Edit: tracking this bug in #61