5

I created two application (first application is a library and another application consuming component from the library).

The intention is to do lazy loading of an imported library.

when I trigger ng serve it gives an error message, but when I trigger ng serve --prod --aot --build-optimizer command no problem. this problem occurs in ng build also.

Error:
ERROR in ./node_modules/bundle/bundle.d.ts
Module build failed: Error: D:\AngularApp\bundle\BaseApp\app2\node_modules\bundle\bundle.d.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.
  1. The library is built with ng-packagr:

    npm run cd
    
  2. created a library *.tgz file.

    npm pack
    
  3. imported library in another application using.

    npm install *.tgz
    

consuming application: tsconfig.json

  //consuming application
            {
                // consuming application    
                "compileOnSave": false,  
                "compilerOptions": // consuming application  {

                "outDir": "./dist/out-tsc",
                "sourceMap": true,
                "declaration": false,
                "moduleResolution": "node",
                "emitDecoratorMetadata": true,
                "experimentalDecorators": true,
                "target": "es5",
                "typeRoots": [
                  "node_modules/@types"
                ],
              //consuming application  
                "lib": [
                   // test  
                  "es2017",
                  "dom"
                ],     

              },
              //consuming application
              "include":[
//test
                    "src/**/*",
                    "node_modules/bundle",
                ],
              // consuming application
                "files": [ 
                  //consume application impored library
                  "node_modules/bundle/bundle.d.ts"  // test
                  //consume application impored library
                 ] 
                 }
n00dl3
  • 21,213
  • 7
  • 66
  • 76
user3637734
  • 101
  • 5

0 Answers0