-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix unit test issue cause by node's module rules
- Loading branch information
Showing
3 changed files
with
27 additions
and
1 deletion.
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,23 @@ | ||
/* | ||
* Workaround for nodes archaic insistence that es modules have ".mjs" extensions or have "type=module" in package.json. | ||
* This script will insert "type": "module" into the package.json of listed modules* | ||
*/ | ||
|
||
const fs = require('fs') | ||
|
||
const packages = ['html2canvas'] | ||
|
||
for (let p of packages) { | ||
forceESM(p) | ||
} | ||
function forceESM(packageName) { | ||
|
||
const packageJSON = require(`../../node_modules/${packageName}/package.json`) | ||
packageJSON['type'] = 'module' | ||
|
||
const outputFile = require.resolve(`../../node_modules/${packageName}/package.json`) | ||
fs.writeFileSync(outputFile, JSON.stringify(packageJSON, null, 2)) | ||
|
||
|
||
} | ||
|
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