Skip to content

Commit

Permalink
fix: warning for requiring CJS module (#428)
Browse files Browse the repository at this point in the history
```
(node:1630) Warning: require() of ES modules is not supported.
require() of /home/runner/work/_actions/ybiquitous/npm-audit-fix-action/v3/dist/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/runner/work/_actions/ybiquitous/npm-audit-fix-action/v3/package.json.
```

https://github.com/ybiquitous/npm-audit-fix-action/runs/2788925152?check_suite_focus=true#step:3:8
  • Loading branch information
ybiquitous committed Jun 10, 2021
1 parent 0048c3d commit b28deb7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ inputs:
default: "dependencies, javascript, security"
runs:
using: "node12"
main: "dist/index.js"
main: "dist/index.cjs"
File renamed without changes.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"type": "module",
"main": "lib/index.js",
"scripts": {
"prepare": "husky install && ncc build lib/index.js -o dist",
"prepare": "husky install && npm run build",
"build": "ncc build lib/index.js --out dist && mv dist/index.js dist/index.cjs",
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testTimeout 30000",
"test:watch": "npm run test -- --watch",
"test:coverage": "npm run test --coverage",
Expand Down

0 comments on commit b28deb7

Please sign in to comment.