grey-matter does not import as a function when using import statements #171
Open
Description
Getting an error when trying to run the following hello world example, I get an error where the matter
export is not a function.
Offending code:
import * as matter from 'gray-matter';
console.log(matter('---\ntitle: Front Matter\n---\nThis is content.'));
Resulting error:
TypeError: matter is not a function
at file:///C:/path/to/index.js:13:13
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:28:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
When I edit the export line in grey-matter/index.js in node modules to display:
module.exports = {matter};
I can then import and run the marked package like this just fine:
import { matter } from 'gray-matter';
console.log(matter('---\ntitle: Front Matter\n---\nThis is content.'));
Are node packages with "type":"module"
not supported or is this behavior a bug?
Metadata
Assignees
Labels
No labels