Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
workaround for require.resolve in prettier-vscode
- Loading branch information
Showing
3 changed files
with
18 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
"use strict"; | ||
|
||
let { resolve } = eval("require"); | ||
|
||
// In the VS Code extension `require` is overridden and `require.resolve` doesn't support the 2nd argument. | ||
if (resolve.length === 1) { | ||
const module = eval("require")("module"); | ||
const createRequire = module.createRequire || module.createRequireFromPath; | ||
resolve = createRequire(__dirname).resolve; | ||
} | ||
|
||
module.exports = resolve; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters