From 03150456cea470e6423e2c74f16a9be0526f9b89 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Sun, 17 Nov 2024 03:39:56 +0000 Subject: [PATCH] fix: rspack with hmr for local dev --- packages/nocodb/rspack.dev.base.config.js | 15 +++++++++++++++ packages/nocodb/src/Noco.ts | 6 +++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/nocodb/rspack.dev.base.config.js b/packages/nocodb/rspack.dev.base.config.js index fa62f284b0..2f21513ddf 100644 --- a/packages/nocodb/rspack.dev.base.config.js +++ b/packages/nocodb/rspack.dev.base.config.js @@ -2,6 +2,7 @@ const { join } = require('path'); const { rspack } = require('@rspack/core'); const NodeExternals = require('webpack-node-externals'); const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin'); +const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin'); const baseDevConfig = { mode: 'development', @@ -21,6 +22,7 @@ const baseDevConfig = { exclude: /node_modules/, loader: 'builtin:swc-loader', options: { + sourceMap: true, jsc: { parser: { syntax: 'typescript', @@ -33,9 +35,16 @@ const baseDevConfig = { decoratorMetadata: true, }, target: 'es2017', + loose: true, + externalHelpers: false, + keepClassNames: true, }, module: { type: 'commonjs', + strict: false, + strictMode: true, + lazy: false, + noInterop: false, }, }, }, @@ -76,6 +85,12 @@ const baseDevConfig = { name: 'main.js', autoRestart: true, }), + new ForkTsCheckerWebpackPlugin({ + typescript: { + context: join(__dirname), + configFile: join('tsconfig.ee-cloud.json'), + }, + }), ], output: { path: join(__dirname, 'dist'), diff --git a/packages/nocodb/src/Noco.ts b/packages/nocodb/src/Noco.ts index 3fc92ba3b6..f186229fe7 100644 --- a/packages/nocodb/src/Noco.ts +++ b/packages/nocodb/src/Noco.ts @@ -105,9 +105,9 @@ export default class Noco { this.initCustomLogger(nestApp); nestApp.flushLogs(); - if (module.hot) { - module.hot.accept(); - module.hot.dispose(() => nestApp.close()); + if ((module as any).hot) { + (module as any).hot.accept(); + (module as any).hot.dispose(() => nestApp.close()); } try {