I am author for an NPM library of browser web components and I wish to alert users that a new version has been released. Library is developed in VueJs.
Since it is not a cli, I cannot use the update-notifier
package as is since the lib code is not executed at installation or build - at least could not find any hook to do this.
So I am trying to detect if my users are executing my library in their development environment or in their production environment. If they are in development I will look for new version and print a message in their console panel.
What I have done is to use the process.env.NODE_ENV
in my library, but when bundled with webpack it get replaced by "production"
, so my user will always have a code with production...
How can I get their process.env.NODE_ENV
?
If I construct code that bypass webpack (such as an eval("process.env.NODE_ENV")
it wont work because the process object does not exists at run time in the browser.
Also, I cannot rely on Angular isDevMode()
since my users may well be using another framework or no framework at all (pure html).
Any idea ?