-
Notifications
You must be signed in to change notification settings - Fork 26.1k
ngc emits JS for Typescript vendor files #20115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Analysis:
Proposed fix:
|
Seems this issue broke my build? Version 5.1.1 works fine. But latest does not generate JS factories, but emit metadata and definitions for files in node_modules |
I am running 5.2.0 and using ngx-boostrap and this seem related to the fact that there is no X.component.js and only X.component.ngfactory.js in the generated node_modules folder. But the factories references have been rewritten to local paths making it impossible to bundle (using rollup). The issue is well described here. Either we have to keep the js files or not rewrite imports for those js files. |
@AllNamesRTaken ... what are you using for building the lib? |
@mlc-mlapis I am using ngc. node_modules\.bin\ngc -p src\tsconfig.json EDIT It does work if I add this to tsconfig.json which indicates that it is related. "include": [
"./main.ts",
"../node_modules/ngx-bootstrap/**/*.component.js",
"../node_modules/ngx-bootstrap/**/*.class.js"
], This forces me to for each such library add a number of specific includes which is less than optimal. |
@AllNamesRTaken ... hmm, we are using With the above steps we don't need to add anything to |
@mlc-mlapis But that does sound like you have a workaround. My point is that a clean ngc should not generate broken files. Either it should not mangle the path, or it should add those js files that are imported using es2015 module format. That you can get it to work I am sure, but it feels like the law of least surprise is not in action here :). |
This has since been fixed - tested with Angular v10 RC.0. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
ngc
will emit JavaScript files for vendor TypeScript files imported by the user app, even if these files are not part of the files included bytsconfig
.Expected behavior
Files that are not included in
tsconfig
should not be compiled.Minimal reproduction of the problem with instructions
After the
ngc
compilation is finished, you can see non-factory JS files emitted for theangular2-click-outside
library:This library was published with TS files, and without metadata:
What is the motivation / use case for changing the behavior?
This behaviour is problematic because it hides improperly packaged libraries, and may fail compilation due to the app TS version being different from the TS version needed by the library.
Environment
Related to angular/angular-cli#8263, angular/angular-cli#8216.
/cc @chuckjaz
The text was updated successfully, but these errors were encountered: