-
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: Nx 12.4 support with Angular 12 and builder improvements #28
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
Conversation
"license": "SEE LICENSE IN <your-license-filename>", | ||
"version": "0.0.0", | ||
"scripts": { | ||
"postinstall": "node ./tools/postinstall.js && npm run ngcc", | ||
"ngcc": "ngcc --tsconfig tsconfig.app.json --properties es2015 module main --first-only" | ||
"ngcc": "<%= pathOffset %>node_modules/.bin/ngcc --tsconfig tsconfig.app.json --properties es2015 module main --first-only" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NathanWalker Many thanks for this update, works like a charm. Please be aware that the generated ../../node_modules/.bin/ngcc --tsconfig tsconfig.app.json --properties es2015 module main --first-only
will only work on unix machines. We have some windows developers in our team, they reported that this leads to an "Command '..' not found" error.
In our case this is not a problem since we're calling ngcc after install in the root package.json (which is in there by default, right?), so we deleted this call.
Before I open an issue (for the windows users):
What's the reason you put this line here? Is it a "just to be sure" matter or is there any reason behind that I am missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this up, I'm curious if you have a suggestion that would work well for windows here?
Essentially when running builds in CI in particular the postinstall does not pick up ngcc
when referenced just like:
"ngcc": "ngcc --tsconfig tsconfig.app.json --properties es2015 module main --first-only"
Because ngcc
is actually installed in root node_modules so the relative path ensures that it executes properly in those environments, however if Windows has an issue with that we need a way to execute ngcc
properly. We had found during testing in some cases (did not seem 100%) however when ngcc
did not process properly after a full clean then the first run would be subject to a runtime ivy related type of error (2nd run would be fine). So executing that after a clean seemed to always help so it is indeed a rather "just to be sure" matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can probably include that handling in the tools/postinstall.js itself and use something like this which would probably help both environments:
const child = childProcess.spawn(/^win/.test(process.platform) ? '..\\..\\node_modules\\.bin\\ngcc' : '../../node_modules/.bin/ngcc', ['--tsconfig', 'tsconfig.app.json', '--properties', 'es2015', 'module', 'main', '--first-only'], {
cwd: process.cwd(),
stdio: 'inherit',
});
child.on('close', (code) => {
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, moving to postinstall.js sounds good. Shall I create another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have it here already, I'll publish another patch shortly with it ❤️ thanks again for mentioning!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Blazing fast, many thanks!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Released in 2.0.2 now - changeset is here:
32284d7
closes #25
closes #23
closes #21