Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
Ensure cached content goes through module._compile() too.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Nov 17, 2017
1 parent 87e9a9e commit ae59e73
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
25 changes: 11 additions & 14 deletions src/hook/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,6 @@ function hook(Module, parent, options) {
}
}

if (isObject(cached)) {
tryCompileCached(mod, cached, filePath, runtimeAlias, options)
return
}

const { _compile } = mod
const shouldOverwrite = env.cli
const shouldRestore = shouldOverwrite && has(mod, "_compile")
Expand All @@ -148,15 +143,17 @@ function hook(Module, parent, options) {
}
}

cached = tryCompileCode(manager, content, {
cacheFileName,
cachePath,
filePath,
hint,
pkgInfo,
runtimeAlias,
type
})
if (! isObject(cached)) {
cached = tryCompileCode(manager, content, {
cacheFileName,
cachePath,
filePath,
hint,
pkgInfo,
runtimeAlias,
type
})
}

if (cached.warnings) {
for (const warning of cached.warnings) {
Expand Down
2 changes: 1 addition & 1 deletion test/node_modules/babel-register/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ae59e73

Please sign in to comment.