Description
Describe the bug
It is not possible to import an npm package via ESM (package: rdf-ext).
I want to import the npm package rdf-ext, but as it is a ESM, I can not import it with require()
Therefore I need to use the import function, see here your documentation:
https://github.com/actions/github-script#use-esm-import
There it is said:
"To import an ESM file, you'll need to reference your script by an absolute path and ensure you have a package.json file with "type": "module" specified."
-> How should I have an absolute path to this package as I want to directly have it used without copying the package to my repo manually or so.
-> How can I achieve the changing of the package.json file? It is not good documentated how to find this and where to change it.
Look for my example repo: https://github.com/jannikreisberg/test-rdf-ext/blob/main/.github/workflows/main.yml
If possible, please just change the main.yml to a version how it will work, would be great!
Error information:
That's the error I got if I use the line:
const rdf = require('rdf-ext');
->
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/runner/work/test-rdf-ext/test-rdf-ext/node_modules/rdf-ext/index.js from /home/runner/work/_actions/actions/github-script/v6/dist/index.js not supported.
13Instead change the require of /home/runner/work/test-rdf-ext/test-rdf-ext/node_modules/rdf-ext/index.js in /home/runner/work/_actions/actions/github-script/v6/dist/index.js to a dynamic import() which is available in all CommonJS modules.
And if I update the line to the import line:
const rdf = import('rdf-ext');
That's the error I got if I use the line ->
Error: Unhandled error: SyntaxError: Cannot use import statement outside a module
Expected behavior
Sucessful import of rdf-ext package
Thanks a lot and Cheers from Hamburg!