Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Replace backward with forward slashes when requiring files on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonio Scandurra committed Mar 15, 2017
1 parent d95a5f1 commit b2983f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion static/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
} else if (useSnapshot) {
Module.prototype.require = function (module) {
const absoluteFilePath = Module._resolveFilename(module, this, false)
const relativeFilePath = path.relative(entryPointDirPath, absoluteFilePath)
let relativeFilePath = path.relative(entryPointDirPath, absoluteFilePath)
if (process.platform === 'win32') {
relativeFilePath = relativeFilePath.replace(/\\/g, '/')
}
let cachedModule = snapshotResult.customRequire.cache[relativeFilePath] // eslint-disable-line no-undef
if (!cachedModule) {
cachedModule = {exports: Module._load(module, this, false)}
Expand Down

0 comments on commit b2983f6

Please sign in to comment.