Giter Club home page Giter Club logo

gitops-secrets-nodejs's People

Contributors

maheshsundaram avatar piccirello avatar ryan-blunden avatar watsonian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gitops-secrets-nodejs's Issues

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

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 :)

[Compatibility] Make it node v10 compatible

@ryan-blunden

Problem:
The exports field in package.json is compateble with node v12 and above, so to make it compatible with lower versions I made the below changes and tested it in my project where I use node v10.

Solution:
Create index.js & no-fs.js file in same lavel where package.json is present and put below code in those files as shown below:

// index.js
module.exports = require('./src');
// index.js
module.exports = require('./src/no-fs');

And I have tested the functionality, it works fine.

Please make the changes as soon as possible, waiting to use the library in our projects.

Thank You

Module Not Found Issue

const secrets = require("gitops-secrets/no-fs");

Above code is creating Module not found error.

In the attached image it can be seen, the getServerSideProps() (part of NextJs) is trying to call loadSecrets() which is a auto generated file by gitops-secrets, but the module is not getting imported correctly & the bellow error occurs

Module not found: Can't resolve 'gitops-secrets/no-fs'

Environment used : NextJs (10.0.5), Node v12.22.12

image

@ryan-blunden @Piccirello Please help...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.