fix(bindings): fix ESM errors in Node bindings
1. The module tries to call the native binary as a function. Only `node-gyp-build` returns a function, so the call is moved there. 2. `node-types.json` is imported with outdated syntax. Use import attributes which require Node 18. 3. The test does not properly catch import errors. This is solved by moving the import inside the assertion.
This commit is contained in:
parent
d29132512b
commit
f222db57ce
3 changed files with 11 additions and 12 deletions
|
|
@ -309,11 +309,10 @@ pub fn generate_grammar_files(
|
|||
if !contents.contains("module") {
|
||||
eprintln!("Updating package.json");
|
||||
contents = contents.replace(
|
||||
indoc! {r#"
|
||||
"repository": {"#},
|
||||
r#""repository":"#,
|
||||
indoc! {r#"
|
||||
"type": "module",
|
||||
"repository": {"#},
|
||||
"repository":"#},
|
||||
);
|
||||
}
|
||||
write_file(path, contents)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue