asotog / squeezebox

Simple Angular 2 accordion component
19 stars 8 forks source link

Not able to build for --prod #19

Open inanmadak opened 6 years ago

inanmadak commented 6 years ago

This issue persists. If I do squeezebox/dist it fails on ng build --prod saying @NgModule tag or strange private public property error.

If I do just squeezebox import withd just 'squeezebox' build works but, then ng serve fails.

These occur independently from tsconfig includes or excludes. So either I can ng build or ng serve not both by using the same import style.

ng build error: node_modules/squeezebox/tests/index.component.ts.AppComponent.html(4,27): : Property 'itemsList' is private and only accessible within class 'AppComponent'

ng serve error: ERROR in ./node_modules/squeezebox/index.ts Module build failed: Error: /Users/username/Code/myproject/node_modules/squeezebox/index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).

asotog commented 6 years ago

mm thanks for that feedback, wondered why picking test code in the build will take a look

inanmadak commented 6 years ago

@asotog hey, any progress on this? Waiting for your comments/fixes.

inanmadak commented 6 years ago

@asotog Please givesome feedback, we need to do a production build. Could you at least remove tests for the current build so that we can use ng build --prod at least.

asotog commented 6 years ago

can you please provide exact angular version you are using ? taking a look now, assuming you are on latest and using cli

inanmadak commented 6 years ago

CLI: 1.7.3 angular: 5.2.9

asotog commented 6 years ago

Wait why you are not using dist ?

import {SqueezeBoxModule} from 'squeezebox/dist';

version 1.4.0

inanmadak commented 6 years ago

dist gives test error, and ng serve does not work. Without dist, ng build does not work gives NgModule error. If i do dist and change your test code variable itemList to public then it works, kinda I hope.

iOS için Outlookhttps://aka.ms/o0ukef uygulamasını edinin


From: Alejandro Soto notifications@github.com Sent: Wednesday, May 16, 2018 5:42:04 PM To: asotog/squeezebox Cc: Inan; Author Subject: Re: [asotog/squeezebox] Not able to build for --prod (#19)

Wait why you are not using dist ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/asotog/squeezebox/issues/19#issuecomment-389544097, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AKMya0HLyEBRTOmHoSIeBZUP-QezP52Nks5tzDq8gaJpZM4Tfnd9.

asotog commented 6 years ago

just published another version please try updating, got rid of private accessor type

inanmadak commented 6 years ago

Okay thanks it is working right now. It is without dist. when we import with 'squeezebox/dist' it gives below error, even though I am doing NgModule import:

ERROR in : Unexpected value 'SqueezeBoxModule in /Users/inan/Code/project-name/node_modules/squeezebox/dist/index.d.ts' imported by the module 'AppModule in /Users/inan/Code/project-name/src/app/app.module.ts'. Please add a @NgModule annotation.

Thanks again.

asotog commented 6 years ago

well you have to use ng module annotations aren't you ? like :

@NgModule({
  imports:      [BrowserModule, SqueezeBoxModule], // here
inanmadak commented 6 years ago

I am already doing that. Currently without 'squeezebox/dist', I can use it for both ng serve and ng build --prod. dist is the problem. I think this version is fine, but here is my feedback anyway so that you can investigate why it is not working with dist.

kaoz70 commented 5 years ago

I'm also getting this error, I can't compile for staging environment:

ng build --configuration=staging

I get the error:

Error: C:\Users\user\Projects\project\node_modules\squeezebox\index.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

But doing an:

ng build

Builds without any errors.

Using:

asotog commented 5 years ago

@kaoz70 can you please attach your tsconfig ?

kaoz70 commented 5 years ago

Sure:

{
  "compileOnSave": false,
  "compilerOptions": {
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "es2015",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom"
    ]
  }
}