Skip to content

Commit

Permalink
fix(node): generate webpack server apps with generatePackageJson:true…
Browse files Browse the repository at this point in the history
… by default
  • Loading branch information
jaysoo committed Aug 21, 2024
1 parent 73f12a3 commit da525c2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 24 additions & 0 deletions packages/node/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions packages/node/src/generators/application/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ function getWebpackBuildConfig(
options.appProjectRoot,
'webpack.config.js'
),
generatePackageJson: true,
},
configurations: {
development: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = {
assets: <%- JSON.stringify(webpackPluginOptions.assets) %>,
optimization: false,
outputHashing: 'none',
generatePackageJson: true,
})
],
};
Expand Down

0 comments on commit da525c2

Please sign in to comment.