@rnw-community/nestjs-webpack-swc 0.27.0 → 0.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -5
- package/readme.md +22 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnw-community/nestjs-webpack-swc",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NestJS typed config",
|
|
6
6
|
"keywords": [
|
|
@@ -35,10 +35,7 @@
|
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=14.0.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@rnw-community/shared": "^0.8.0"
|
|
41
|
-
},
|
|
38
|
+
"gitHead": "32e34a71dd3d8b52bf77d4b0d800fb8ed763ff80",
|
|
42
39
|
"devDependencies": {
|
|
43
40
|
"@types/webpack-env": "^1.18.0",
|
|
44
41
|
"@types/webpack-node-externals": "^2.5.3",
|
package/readme.md
CHANGED
|
@@ -37,7 +37,7 @@ module.exports = require('@rnw-community/nestjs-webpack-swc').getNestJSWebpackDe
|
|
|
37
37
|
Create `webpack-prod.config.js` in root of the NestJS package:
|
|
38
38
|
|
|
39
39
|
```js
|
|
40
|
-
module.exports = require('@
|
|
40
|
+
module.exports = require('@rnw-community/nestjs-webpack-swc').getNestJSWebpackProdConfig;
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
### Scripts package.json
|
|
@@ -45,8 +45,10 @@ module.exports = require('@dotgoclub/be-lib').getNestJSWebpackProdConfig;
|
|
|
45
45
|
Change `package.json` `build`, `start:dev` scripts:
|
|
46
46
|
|
|
47
47
|
```json
|
|
48
|
-
|
|
49
|
-
"
|
|
48
|
+
{
|
|
49
|
+
"build": "nest build --webpack --webpackPath webpack-prod.config.js",
|
|
50
|
+
"start:dev": "nest build --webpack --webpackPath webpack-dev.config.js --watch"
|
|
51
|
+
}
|
|
50
52
|
```
|
|
51
53
|
|
|
52
54
|
## Typeorm migrations
|
|
@@ -54,12 +56,22 @@ Change `package.json` `build`, `start:dev` scripts:
|
|
|
54
56
|
If your project is using [TypeORM](https://typeorm.io), then you will face problems with running migrations from NestJS app,
|
|
55
57
|
this package provides utility for loading TypeORM migrations within webpack build.
|
|
56
58
|
|
|
57
|
-
Install additional peer dependencies:
|
|
59
|
+
1. Install additional peer dependencies:
|
|
58
60
|
|
|
59
61
|
- [@types/webpack-env](https://www.npmjs.com/package/@types/webpack-env)
|
|
60
62
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
2. Add this package to your `tsconfig.*.json` files:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"compilerOptions": {
|
|
68
|
+
"types": ["node", "@types/webpack-env"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
3. Add code that will return class instances array that you can pass to TypeORM configuration, you will only need to provide
|
|
74
|
+
path to the folder where all migrations are stored:
|
|
63
75
|
|
|
64
76
|
```ts
|
|
65
77
|
const migrations = importTypeormWebpackMigrations(require.context('./migration/', true, /\.ts$/u));
|
|
@@ -73,6 +85,8 @@ you may end up with `Error: Bindings not found` SWC error, this is happening bec
|
|
|
73
85
|
`package.json` script and add it to `postinstall` script:
|
|
74
86
|
|
|
75
87
|
```json
|
|
76
|
-
|
|
77
|
-
"
|
|
88
|
+
{
|
|
89
|
+
"swc-install-bindings": "npm install --no-save --loglevel=error --prefer-offline --no-audit --progress=false --force @swc/core-linux-arm64-musl @swc/core-linux-x64-musl",
|
|
90
|
+
"postinstall": "yarn swc-install-bindings"
|
|
91
|
+
}
|
|
78
92
|
```
|