Use configuration file to initialize a node_modules library

Viewed 73

I made a react component library that I would like to use in multiple projects. I need to use different variables depending on the environments, for this reason I was thinking of using an initialization file (eg: my-library.init.js) in the host app that exports a config variable, but I don't know how to make the library read this variable from host app. the file should look like this:

export const config = {
  envs: {
    S3_URL: 'https://my.dev.url.org'
    ENV: 'dev'
  }
}

Any help will be appreciated Tahnk you

0 Answers
Related