You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2021/10/06 13:28:52 UTC

[echarts] branch svg-ssr updated: chore: add process env define in dev

This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch svg-ssr
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/svg-ssr by this push:
     new dec7082  chore: add process env define in dev
dec7082 is described below

commit dec7082d383f96ca73e79b846ee3cf3385b5f065
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Oct 6 21:22:39 2021 +0800

    chore: add process env define in dev
---
 build/dev-fast.js | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/build/dev-fast.js b/build/dev-fast.js
index 8d417e7..81a58d3 100644
--- a/build/dev-fast.js
+++ b/build/dev-fast.js
@@ -20,14 +20,16 @@
 
 const path = require('path');
 const {build} = require('esbuild');
-
+const commander = require('commander');
 const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
 
 const umdMark = '// ------------- WRAPPED UMD --------------- //';
 const umdWrapperHead = `
 ${umdMark}
-typeof window !== 'undefined' ? window.__DEV__ = true
-    : typeof global !== 'undefined' ? global.__DEV__ = true : __DEV__ = true;
+(function () {
+    var g = typeof self !== 'undefined' ? self : this;
+    g.__DEV__ = true;
+})();
 (function (root, factory) {
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
@@ -53,15 +55,19 @@ build({
     bundle: true,
     banner: umdWrapperHead,
     footer: umdWrapperTail,
+    define: {
+        'process.env.NODE_ENV': '"development"'
+    },
     watch: {
         async onRebuild(error) {
             if (error) {
                 console.error('watch build failed:', error)
-            } else {
-                console.log('build done')
+            }
+            else {
+                console.log('Bundled with esbuild')
             }
         },
     },
 }).then(async () => {
-    console.log('build done')
+    console.log('Bundled with esbuild')
 }).catch(e => console.error(e.toString()))

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org