nx: Deprecation Warning @nrwl/node:webpack" executor is deprecated. Use "@nrwl/webpack:webpack" instead in your project.json breaks @nrwl/nest typeorm generation process
Current Behavior
Failed to due missing babelrc file. -> also adding an empty one, is not working
Expected Behavior
Generated necessary files or run through, without any errors.
GitHub Repo
https://github.com/Meywether/nx_error
Steps to Reproduce
- create a clean workspace
- add typeorm.config.ts
- add test entity
- add build steps in project.json of notion app
- run any command for generate or create migration: nx run notion:typeorm-generate-migration
Nx Report
Node : 18.14.0
OS : win32 x64
npm : 9.3.1
nx : 15.8.9
@nrwl/js : 15.8.9
@nrwl/jest : 15.8.9
@nrwl/linter : 15.8.9
@nrwl/workspace : 15.8.9
@nrwl/cli : 15.8.9
@nrwl/devkit : 15.8.9
@nrwl/eslint-plugin-nx : 15.8.9
@nrwl/nest : 15.8.9
@nrwl/node : 15.8.9
@nrwl/tao : 15.8.9
@nrwl/webpack : 15.8.9
typescript : 4.9.
Failure Logs
$ nx run notion:typeorm-generate-migration ./src/migrations/test1
> nx run notion:build-migration-config
Entrypoint main = runtime.js main.js 1 auxiliary asset
chunk (runtime: runtime) main.js (main) 39 bytes [initial] [rendered]
chunk (runtime: runtime) runtime.js (runtime) 2.46 KiB [entry] [rendered]
ERROR in ./src/typeorm.config.ts
Module build failed (from ../../node_modules/@nrwl/webpack/src/utils/web-babel-loader.js):
Error: Cannot find module 'C:\Users\user\Desktop\repos_company\company-metrics\apps\notion\.babelrc'
Require stack:
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\config\files\configuration.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\config\files\index.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\index.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\babel-loader\lib\index.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@nrwl\webpack\src\utils\web-babel-loader.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\loader-runner\lib\loadLoader.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\loader-runner\lib\LoaderRunner.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\webpack\lib\NormalModuleFactory.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\webpack\lib\Compiler.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\webpack\lib\webpack.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\webpack\lib\index.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@nrwl\webpack\src\utils\with-nx.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@nrwl\webpack\src\executors\webpack\lib\get-webpack-config.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@nrwl\webpack\src\executors\webpack\webpack.impl.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\nx\src\config\workspaces.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\nx\src\command-line\run.js
- C:\Users\user\Desktop\repos_company\company-metrics\node_modules\nx\bin\run-executor.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1047:15)
at resolve (node:internal/modules/cjs/helpers:109:19)
at loadConfig (C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\config\files\configuration.js:209:5)
at loadConfig.next (<anonymous>)
at buildRootChain (C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\config\config-chain.js:65:47)
at buildRootChain.next (<anonymous>)
at loadPrivatePartialConfig (C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\config\partial.js:79:62)
at loadPrivatePartialConfig.next (<anonymous>)
at Object.<anonymous> (C:\Users\user\Desktop\repos_company\company-metrics\node_modules\@babel\core\lib\config\partial.js:122:25)
at Generator.next (<anonymous>)
webpack compiled with 1 error (9df8a09bd0720ed9)
Additional Information
Hi there, thanks for your time, this additional info I can add:
With the old executor: @nrwl/node:webpack it is working
so I do not know why I need the babelrc file or where and with which input i need to touch it.
Please help me out here š
Many thanks !
Kind regards Meywether
After adding .babelrc:
{
"plugins": [
["@babel/plugin-proposal-decorators", { "decoratorsBeforeExport": true }],
"@babel/plugin-transform-typescript",
"@babel/plugin-proposal-class-properties"]
}
I got this error:
ERROR in ../../node_modules/dotenv/lib/main.js 24:11-24
Module not found: Error: Can't resolve 'fs' in 'C:\Users\user\Desktop\repos_company\company-metrics\node_modules\dotenv\lib'
ERROR in ../../node_modules/dotenv/lib/main.js 25:13-28
Module not found: Error: Can't resolve 'path' in 'C:\Users\user\Desktop\repos_company\company-metrics\node_modules\dotenv\lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
ERROR in ../../node_modules/dotenv/lib/main.js 26:11-24
Module not found: Error: Can't resolve 'os' in 'C:\Users\user\Desktop\repos_company\company-metrics\node_modules\dotenv\lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
- install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "os": false }
ERROR in ../../node_modules/react-native/index.js 14:7
Module parse failed: Unexpected token (14:7)
File was processed with these loaders:
* ../../node_modules/source-map-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
|
| // Components
> import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';
| import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
| import typeof Button from './Libraries/Components/Button';
webpack compiled with 4 errors (e742d1a9d24fa22e)
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 6
- Comments: 17 (6 by maintainers)
Commits related to this issue
- fix(node): extend @nx/node:webpack migration to all targets Related: #15903 — committed to jaysoo/nx by jaysoo a year ago
Hello, I have just upgraded to version 16.1.3 and I am still having issues being able to run a nestjs application. I created another nx/nest application to compare the isolated project.json with my existing codebase for a quick fix. There seem to be new properties under targets build:
also the executor for serve is now @nx/js:node while the build should be @nx/webpack:webpack
The last property I did not have and copied the file over to my existing app.
Running serve:production seems to be working
@Meywether @Niaro @Botosio The following options are needed to build Node source with webpack:
Why these are needed:
target: 'node'- the default webpack target is web (consistent with webpack itself)compiler: 'tsc'- the default compiler is now babel for the web, so set to tsc for NodeisolatedConfig: true- previously, Nx will add some configuration in the executor, this will not be the case once Nx 17 lands so users should maintain their ownwebpack.config.jsfile (we still provide plugins to integrate with Nx)webpackConfig: '...'- See aboveIf you donāt have a webpack config file for the project, you can use the following:
There was a migration for it, but it only ran against
buildtargets. Weāll add another migration for the remaining targets. Sorry about that.Let me know if adding those options solved the issue.
After a migration, I am now seeing the same issue. AFAIK there is no migration command in the new
nxversion equivalent to thenx g @nrwl/workspace:fix-configurationfor theworkspace.jsonfile. Would be nice if this could get cleared up!I see the same issue. I mentioned it on Slack: https://nrwlcommunity.slack.com/archives/CMFKWPU6Q/p1680700750050249