asotog / squeezebox

Simple Angular 2 accordion component

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to build for --prod

inanmadak opened this issue · comments

commented

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).

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

commented

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

commented

@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.

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

commented

CLI: 1.7.3
angular: 5.2.9

Wait why you are not using dist ?

import {SqueezeBoxModule} from 'squeezebox/dist';

version 1.4.0

commented

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

commented

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.

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

@NgModule({
  imports:      [BrowserModule, SqueezeBoxModule], // here

commented

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.

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:

  • Angular CLI: 7.0.3
  • Node: 8.11.2
  • OS: Windows 10 x64
  • Angular: 7.0.2

@kaoz70 can you please attach your tsconfig ?

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"
    ]
  }
}