From 55d7a49dbc4d4de3d4c7fa2ec60827d7e402cc4f Mon Sep 17 00:00:00 2001 From: whyour Date: Sat, 27 Nov 2021 17:19:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Ddeps=E6=98=A0=E5=B0=84?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/deps.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/back/loaders/deps.ts b/back/loaders/deps.ts index 2a77fc2e..a392eb1a 100644 --- a/back/loaders/deps.ts +++ b/back/loaders/deps.ts @@ -1,10 +1,11 @@ import path from 'path'; import fs from 'fs'; import chokidar from 'chokidar'; +import config from '../config/index'; function linkToNodeModule(src: string, dst?: string) { - const target = path.join(__dirname, 'node_modules', dst || src); - const source = path.join(__dirname, src); + const target = path.join(config.rootPath, 'node_modules', dst || src); + const source = path.join(config.rootPath, src); fs.lstat(target, (err, stat) => { if (!stat) { @@ -18,7 +19,7 @@ function linkToNodeModule(src: string, dst?: string) { export default async (src: string = 'deps') => { linkToNodeModule(src); - const source = path.join(__dirname, src); + const source = path.join(config.rootPath, src); const watcher = chokidar.watch(source, { ignored: /(^|[\/\\])\../, // ignore dotfiles persistent: true,