I have shared code that is used in the backend and frontend (I use Next for the frontend).
A piece of the shared code (library):
import { ApiProperty } from '@nestjs/swagger'
export class AccessTokenResponseDto {
@ApiProperty({
example: 'xxxxx.xxxxx.xxxxx',
})
public token!: string
}
Now I want to ignore @nestjs/swagger
in the frontend BUT do not lose the functionality of the documentation feature in the backend.
The reason why I want to ignore nestjs
in the frontend is to reduce the build size.
Try this: https://webpack.js.org/configuration/externals/#root
The externals configuration can exclude dependencies.
And you need two different script in package.json to distinguish different building env(one for frontend, one for backend).