Hi Martin, It's a very common way to check if it's a production environment. vue.js, react also do the same. Writing more complex checking code may break more bundlers and failed to do the dead code removing.
Regards. On Thu, Feb 18, 2021 at 1:50 PM Martin Kuhn <martin.k...@gmx.at> wrote: > Hi Yi, > > yeah, but a more developer friendly behavior would be good. > Currently you get an error, where you have to figure out yourself what the > reason is. > > I would suggest to check if the variable is defined and when not to assume > a save value and log out that the lib expects the var… > > Also, it should be documented (I had no luck to find this in the doc). > > > Regards > Martin > > On 2021/02/17 02:20:57, Yi Shen <s...@gmail.com> wrote: > > Hi Martin> > > > > process.env.NODE_ENV will be replaced with 'production' or 'development' > in> > > most of the bundlers like webpack. So the minifier can shake the dead > code> > > only for dev environment.> > > If you are using rollup. There is a plugin-replace[1] can do this job> > > > > [1] https://www.npmjs.com/package/@rollup/plugin-replace> > > > > On Sat, Feb 13, 2021 at 12:44 AM Martin Kuhn <ma...@gmail.com>> > > wrote:> > > > > >> > > > When I use echarts with sveltejs (and rollup build) I got an error at> > > > runtime when I do not define process.env.NODE_ENV.> > > >> > > > The error occurs in echarts/lib/util/clazz.js.> > > >> > > > Is this really necessary?> > > >> > > > ---------------------------------------------------------------------> > > > To unsubscribe, e-mail: dev-unsubscr...@echarts.apache.org> > > > For additional commands, e-mail: dev-h...@echarts.apache.org> > > >> > > >> > > > > -- > > > Yi Shen> > > Apache ECharts(incubating) PMC> > > > -- Yi Shen Apache ECharts(incubating) PMC