Skip to content

Commit a8ad4ac

Browse files
committed
Handle no node_modules directory
1 parent 424fe49 commit a8ad4ac

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Diff for: src/index.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,14 @@ export class TypeScriptPlugin {
195195
fs.unlinkSync(outModulesPath)
196196
}
197197

198-
fs.copySync(
199-
path.resolve('node_modules'),
200-
path.resolve(path.join(BUILD_FOLDER, 'node_modules'))
201-
)
198+
if (fs.existsSync(path.resolve('node_modules'))) {
199+
fs.copySync(
200+
path.resolve('node_modules'),
201+
outModulesPath
202+
)
203+
} else {
204+
fs.mkdirSync(outModulesPath)
205+
}
202206
} else {
203207
if (!fs.existsSync(outModulesPath)) {
204208
await this.linkOrCopy(path.resolve('node_modules'), outModulesPath, 'junction')

0 commit comments

Comments
 (0)