Skip to content

Commit

Permalink
Fix require path in react-refresh transformer (parcel-bundler#3815)
Browse files Browse the repository at this point in the history
  • Loading branch information
devongovett authored Nov 20, 2019
1 parent d4b611a commit 0ef5e89
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ export default new Transformer({
return [asset];
}

let wrapperPath = path.relative(path.dirname(asset.filePath), WRAPPER);
let wrapperPath = path
.relative(path.dirname(asset.filePath), WRAPPER)
.replace(/\\/g, '/');
if (!wrapperPath.startsWith('.')) {
wrapperPath = './' + wrapperPath;
}

ast.program.program.body = wrapper({
helper: t.stringLiteral(wrapperPath),
Expand Down

0 comments on commit 0ef5e89

Please sign in to comment.