Skip to content

Commit

Permalink
fix: serverless-offline v8.6 and later unloads all modules when runni…
Browse files Browse the repository at this point in the history
…ng on Windows, breaking plugins (#1461) (#1462)
  • Loading branch information
coyoteecd authored Jun 14, 2022
1 parent aaccf96 commit af441b2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lambda/handler-runner/in-process-runner/clearModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default async function clearModule(fP, opts) {
for (const c of cld) {
// Unload any non node_modules and non-binary children
if (
!c.filename.match(/\/node_modules\//i) &&
!c.filename.match(/[/\\]node_modules[/\\]/i) &&
!c.filename.match(/\.node$/i)
) {
// eslint-disable-next-line no-await-in-loop
Expand All @@ -68,7 +68,7 @@ export default async function clearModule(fP, opts) {
require.cache[fn].parent &&
require.cache[fn].parent.id !== '.' &&
!require.cache[require.cache[fn].parent.id] &&
!fn.match(/\/node_modules\//i) &&
!fn.match(/[/\\]node_modules[/\\]/i) &&
!fn.match(/\.node$/i)
) {
delete require.cache[fn]
Expand Down

0 comments on commit af441b2

Please sign in to comment.