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 2020/12/29 09:10:49 UTC

[incubator-echarts-examples] branch next updated: add configuration of esm

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

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


The following commit(s) were added to refs/heads/next by this push:
     new 3aa8c65  add configuration of esm
3aa8c65 is described below

commit 3aa8c650fcef812bb098b1999e5657c1af4eda20
Author: pissang <bm...@gmail.com>
AuthorDate: Tue Dec 29 17:10:33 2020 +0800

    add configuration of esm
---
 common/buildCode.js   |  8 ++++----
 src/editor/Editor.vue | 16 ++++++++++++++--
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/common/buildCode.js b/common/buildCode.js
index 0d49423..d619b62 100644
--- a/common/buildCode.js
+++ b/common/buildCode.js
@@ -241,10 +241,10 @@ module.exports.buildExampleCode = function (
         esm = true;
     }
 
-    if (minimal && !esm) {
-        // Only legacy mode can be used when use require in mimimal bundle.
-        legacy = true;
-    }
+    // if (minimal && !esm) {
+    //     // Only legacy mode can be used when use require in mimimal bundle.
+    //     legacy = true;
+    // }
 
     if (ts) {
         esm = true;
diff --git a/src/editor/Editor.vue b/src/editor/Editor.vue
index e95d4d2..ef82bf2 100644
--- a/src/editor/Editor.vue
+++ b/src/editor/Editor.vue
@@ -38,6 +38,12 @@
                             :active-text="$t('editor.minimalImport')"
                             :inactive-text="''">
                         </el-switch>
+                        <el-switch
+                            class="enable-decal"
+                            v-model="fullCodeConfig.esm"
+                            active-text="ES Modules"
+                            :inactive-text="''">
+                        </el-switch>
                     </el-header>
                     <el-main>
                         <FullCodePreview :code="fullCode"></FullCodePreview>
@@ -88,7 +94,7 @@ export default {
 
             fullCodeConfig: {
                 mimimal: false,
-                module: 'esm',   // esm, cjs, plain
+                esm: true,
                 node: false // If is in node
             }
         };
@@ -155,7 +161,9 @@ export default {
             this.fullCode = buildExampleCode(store.sourceCode, deps, {
                 minimal: this.fullCodeConfig.minimal,
                 ts: false,
-                esm: this.fullCodeConfig.module === 'esm',
+                esm: this.fullCodeConfig.esm,
+                // Only legacy mode can be used when use require in mimimal bundle.
+                legacy: !this.fullCodeConfig.esm && this.fullCodeConfig.minimal,
                 theme: store.darkMode ? 'dark' : '',
                 ROOT_PATH: store.cdnRoot
             });
@@ -300,6 +308,10 @@ $handler-width: 5px;
         vertical-align: middle;
         margin: 0 0 0 20px;
     }
+
+    .el-switch__label * {
+        font-size: 12px;
+    }
 }
 
 #editor-control-panel {


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