Build with --watch option produces an empty module
somq opened this issue · comments
Type of Issue
[x] Bug Report
[ ] Feature Request
Description
Transpiled library module is empty when building the lib with the --watch
option with the latest versions (16.x)
How To Reproduce
- Bootstrap an app and a lib
- Run the build with the
--watch
option (i.e.ng build ngx-mylib --configuration development --watch
) - Edit a lib file such as the generated service
- The transpiled module appears to be empty
Example
In dist/ngx-mylib/lib/ngx-mylib.module.d.ts
export declare class NgxMyLibModule {
}
//# sourceMappingURL=ngx-mylib.module.d.ts.map
Version Information
$ node_modules/.bin/ng-packagr --version
ng-packagr: 16.2.0-next.1
@angular/compiler: 16.1.7
rollup: 3.26.2
typescript: 5.1.6
Additional
Tried all v16 versions and finally downgraded to v15 which actually works.
Not 100% sure this issue belongs here, apologies if it's not the case 🙏
Having the same issue compiling a library.
- Using partial and full compilation triggers the same issue.
- Enabling or disabling the cache triggers the same issue.
I do not have any circular dependencies in my code.
The error is not triggered every time, sometimes the emitted code will be fine.
The way i can reproduce the error the most easily is when :
- i introduce an error in the code which makes the library recompile with an error,
- i fix the error, making the library compile well in appearance, but the
ɵfac
,ɵmod
andɵinj
are missing from the code.
angular/angular-cli#25706 has provided a repro:
- Get the project from https://github.com/t0m-4/lib-build-watch/tree/main
- Run 'ng build my-lib --watch --configuration development'.
- Check the file my-workspace\dist\my-lib\ui\form\form.module.d.ts
- Update the file my-workspace\projects\my-lib\ui\form\models\form-type.model.ts (for exemple set another value for the enum value 'Other'
- Check again the file my-workspace\dist\my-lib\ui\form\form.module.d.ts, some imports disappeared.
Than you @JeanMeche i didn't find this ticket when I created mine
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
This action has been performed automatically by a bot.