Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@rnw-community/nestjs-webpack-swc
Advanced tools
NestJS webpack and SWC configuration helpers, this can speed up your local NestJS development up to 10x.
This package helps to easily configure NestJS webpack and SWC integration and make you DX good and quick again
@rnw-community/nestjs-webpack-swc
using your package managerCreate webpack-dev.config.js
in root of the NestJS package:
module.exports = require('@rnw-community/nestjs-webpack-swc/get-nestjs-webpack-dev.config').getNestJSWebpackDevConfig;
Create webpack-prod.config.js
in root of the NestJS package:
module.exports = require('@rnw-community/nestjs-webpack-swc/get-nestjs-webpack-prod.config').getNestJSWebpackProdConfig;
For blazing fast DX, this package provides utility to simplify HMR configuration:
import { handleNestJSWebpackHmr } from '@rnw-community/nestjs-webpack-swc';
const bootstrap = async (): Promise<void> => {
//...
handleNestJSWebpackHmr(app, module);
};
Change package.json
build
, start:dev
scripts:
{
"build": "nest build --webpack --webpackPath webpack-prod.config.js",
"start:dev": "nest build --webpack --webpackPath webpack-dev.config.js --watch"
}
For maximum speed webpack is configured to generate filesystem cache and uses .build_cache
folder
in package root, so you need to add it to your .gitignore
file.
Due to webpack bundling approach you may encounter problems with packages that use absolute/relative paths, each of this cases needs separate solutions. Feel free to open an issue.
If your project is using TypeORM, then you will face problems with running migrations from NestJS app, this package provides utility for loading TypeORM migrations within webpack build.
tsconfig.*.json
files:{
"compilerOptions": {
"types": ["node", "@types/webpack-env"]
}
}
const migrations = importTypeormWebpackMigrations(require.context('./migration/', true, /\.ts$/u));
With webpack in place you will not have your migrations transpiled into the dist folder anymore so to use typeorm cli you will need additional changes:
package.json
scripts(you should have tsconfig.build.json
with module:commonjs
):{
"scripts": {
"typeorm": "ts-node -P tsconfig.build.json -r tsconfig-paths/register ./node_modules/.bin/typeorm",
"migrate:create": "yarn typeorm migration:create -d ./data-source.mjs",
"migrate:down": "yarn typeorm migration:revert -d ./data-source.mjs",
"migrate:generate": "yarn typeorm migration:generate -d ./data-source.mjs",
"migrate:up": "yarn typeorm migration:run -d ./data-source.mjs"
}
}
-d ./data-source.mjs
is a TypeORM v3 breaking changes you can remove it for v2
If your project is running inside the docker container and your host system has different architecture
you may end up with Error: Bindings not found
SWC error, this is happening because when you install
SWC it uses the bindings for your host machine, to fix this:
.yarnrc
file in the project root:--ignore-engines true
--ignore-platform true
{
"@swc/core-linux-arm64-musl": "^1.2.242",
"@swc/core-linux-x64-musl": "^1.2.242"
}
This library is licensed under The MIT License.
FAQs
NestJS typed config
We found that @rnw-community/nestjs-webpack-swc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.