如何让nestjs监视特定的节点模块?

Tal*_*ofe 6 webpack nestjs

在我的应用程序中,我想让 NestJS 在特定节点模块发生更改后重新加载开发模式。

我运行这个脚本:nest build --watch

我的nest-cli.json文件是:

{
    "$schema": "https://json.schemastore.org/nest-cli",
    "collection": "@nestjs/schematics",
    "sourceRoot": "src",
    "compilerOptions": {
        "webpack": true,
        "webpackConfigPath": "./webpack.config.js",
        "deleteOutDir": true
    }
}
Run Code Online (Sandbox Code Playgroud)

我的 webpack 文件是:

const nodeExternals = require('webpack-node-externals');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');

const { version } = require('../../package.json');

const configuration = (options, webpack) => ({
    ...options,
    entry: ['webpack/hot/poll?100', options.entry],
    externals: [
        nodeExternals({
            allowlist: ['webpack/hot/poll?100'],
        }),
    ],
    plugins: [
        ...options.plugins,
        new webpack.HotModuleReplacementPlugin(),
        new webpack.WatchIgnorePlugin({
            paths: [/\.d\.ts$/],
        }),
        new RunScriptWebpackPlugin({ name: options.output.filename, autoRestart: false }),
        new webpack.DefinePlugin({
            __PACKAGE_VERSION__: JSON.stringify(version),
        }),
    ],
});

module.exports = configuration;
Run Code Online (Sandbox Code Playgroud)

一旦这个包发生变化,我想让 NestJS 在开发模式下重新编译:node_modules/@blabla/common 因为这个包是链接到我的项目的私有包。