-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(webpack): fix default compiler option #22762
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit b33ac0d. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 6 targets
Sent with 💌 from NxCloud. |
@jaysoo I see you applied these defaults previously coming from the executor schema 4 months ago, so your input is appreciated :) |
given a configuration without tsConfig the babel compiler breaks applying Nx dependent config
90fc5ee
to
b33ac0d
Compare
Given a configuration without `options.tsConfig` the `babel` compiler breaks in `createLoaderFromCompiler` where the babel case uses `path.join(options.root, options.tsConfig)` and throws an exception if it's undefined. ## Current Behavior In my case, the root `package.json` generates a dependency in the tree with "empty" options: ``` { root: '/root/of/my/monorepo/monorepo', projectRoot: '', sourceRoot: '', outputFileName: undefined, outputPath: undefined, assets: [], target: 'web', projectName: undefined, targetName: undefined, configurationName: undefined, projectGraph: undefined } ``` which breaks the project graph with this exception: ``` Unable to read angular.json [Failed to process project graph. The "@nx/webpack/plugin" plugin threw an error while creating nodes from src/backend/server/webpack.config.js: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined at new NodeError (node:internal/errors:405:5) at validateString (node:internal/validators:162:11) at Object.join (node:path:1171:7) at createLoaderFromCompiler (/monorepo/node_modules/.pnpm/@nx[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_t_auhl3zn4afi4laot7gdsrcezcy/node_modules/@nx/webpack/src/plugins/nx-webpack-plugin/lib/compiler-loaders.js:50:58) at applyNxDependentConfig (/monorepo/node_modules/.pnpm/@nx[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_t_auhl3zn4afi4laot7gdsrcezcy/node_modules/@nx/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.js:314:61) at applyBaseConfig (/monorepo/node_modules/.pnpm/@nx[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_t_auhl3zn4afi4laot7gdsrcezcy/node_modules/@nx/webpack/src/plugins/nx-webpack-plugin/lib/apply-base-config.js:36:5) at configure (/monorepo/node_modules/.pnpm/@nx[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_t_auhl3zn4afi4laot7gdsrcezcy/node_modules/@nx/webpack/src/utils/with-nx.js:15:49) at combined (/monorepo/node_modules/.pnpm/@nx[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_t_auhl3zn4afi4laot7gdsrcezcy/node_modules/@nx/webpack/src/utils/config.js:23:28) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async readWebpackOptions (/monorepo/node_modules/.pnpm/@nx[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]_t_auhl3zn4afi4laot7gdsrcezcy/node_modules/@nx/webpack/src/utils/webpack/read-webpack-options.js:17:18)] { name: 'ProjectGraphError' } ``` ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The default values should fallback properly without throwing an exception for this case. --------- Co-authored-by: Colum Ferry <[email protected]> (cherry picked from commit 7dd7c2b)
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Given a configuration without
options.tsConfig
thebabel
compiler breaks increateLoaderFromCompiler
where the babel case usespath.join(options.root, options.tsConfig)
and throws an exception if it's undefined.Current Behavior
In my case, the root
package.json
generates a dependency in the tree with "empty" options:which breaks the project graph with this exception:
Expected Behavior
The default values should fallback properly without throwing an exception for this case.