DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

How I can provide an api url to my library that is run via the browser?

I am making a javascript library for a widget for my service to 3rd party services.

I have a JavaScript project that builds a widget used by third party websites and consumes my API. The library is configured by a JavaScript file names config.js:

api_url="https://example.com";

module.exports={
  'api_url': api_url
};

What I want is ton replace the api_url depending on my build environment with the appropriate…

And I want to build my library's configuration with correct parameter that is build with. DO you have any idea how I can achieve that?

Top comments (0)