diff --git a/packages/node/src/generators/application/application.legacy.spec.ts b/packages/node/src/generators/application/application.legacy.spec.ts index 9a56a513d9f22..21044e90c13f4 100644 --- a/packages/node/src/generators/application/application.legacy.spec.ts +++ b/packages/node/src/generators/application/application.legacy.spec.ts @@ -42,6 +42,7 @@ describe('node app generator (legacy)', () => { "my-node-app/src/assets", ], "compiler": "tsc", + "generatePackageJson": true, "main": "my-node-app/src/main.ts", "outputPath": "dist/my-node-app", "target": "node", diff --git a/packages/node/src/generators/application/application.spec.ts b/packages/node/src/generators/application/application.spec.ts index d41ede16d3084..50482703ca2c8 100644 --- a/packages/node/src/generators/application/application.spec.ts +++ b/packages/node/src/generators/application/application.spec.ts @@ -63,6 +63,30 @@ describe('app', () => { }, } `); + expect(tree.read(`my-node-app/webpack.config.js`, 'utf-8')) + .toMatchInlineSnapshot(` + "const { NxAppWebpackPlugin } = require('@nx/webpack/app-plugin'); + const { join } = require('path'); + + module.exports = { + output: { + path: join(__dirname, '../dist/my-node-app'), + }, + plugins: [ + new NxAppWebpackPlugin({ + target: 'node', + compiler: 'tsc', + main: './src/main.ts', + tsConfig: './tsconfig.app.json', + assets: ['./src/assets'], + optimization: false, + outputHashing: 'none', + generatePackageJson: true, + }), + ], + }; + " + `); expect(() => readProjectConfiguration(tree, 'my-node-app-e2e') ).not.toThrow(); diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index b889224c70d9f..541b1d8517c97 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -79,6 +79,7 @@ function getWebpackBuildConfig( options.appProjectRoot, 'webpack.config.js' ), + generatePackageJson: true, }, configurations: { development: {}, diff --git a/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ b/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ index e913fff9c264a..052c7a86d19ee 100644 --- a/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ +++ b/packages/node/src/generators/application/files/common/webpack.config.js__tmpl__ @@ -15,6 +15,7 @@ module.exports = { assets: <%- JSON.stringify(webpackPluginOptions.assets) %>, optimization: false, outputHashing: 'none', + generatePackageJson: true, }) ], };