Skip to content

Using with "type": "module", in package.json / ES6 #32

@matoni109

Description

@matoni109

Hi Team,

Trying to spin this up for a nodejs app and running into issues as we have

"type": "module",

set in our package.json

[nodemon] starting `node src/server.js`
file:///Users/me/code/platform-gateway/lib/secrets.js:3
const secrets = require("gitops-secrets/no-fs");
                ^

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/Users/me/code/platform-gateway/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///Users/me/code/platform-gateway/lib/secrets.js:3:17

Is there an easy enough way around this ?

Chris :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions