You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2022/03/03 13:55:06 UTC

[GitHub] [echarts] susiwen8 opened a new pull request #16619: dev-build: update esbuild

susiwen8 opened a new pull request #16619:
URL: https://github.com/apache/echarts/pull/16619


   <!-- Please fill in the following information to help us review your PR more efficiently. -->
   
   ## Brief Information
   
   This pull request is in the type of:
   
   - [ ] bug fixing
   - [ ] new feature
   - [x] others
   
   
   
   ### What does this PR do?
   
   Since `esbuild` decide to improve compatibility with Webpack and Node. After version 0.14.4, esbuild adjust the way of handling of `default exports` and the `__esModule` marker
   
   https://github.com/evanw/esbuild/releases/tag/v0.14.4
   
   
   
   ### Fixed issues
   
   <!--
   - #xxxx: ...
   -->
   
   
   ## Details
   
   ### Before: What was the problem?
   
   <!-- DESCRIBE THE BUG OR REQUIREMENT HERE. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ### After: How is it fixed in this PR?
   
   <!-- THE RESULT AFTER FIXING AND A SIMPLE EXPLANATION ABOUT HOW IT IS FIXED. -->
   
   <!-- ADD SCREENSHOT HERE IF APPLICABLE. -->
   
   
   
   ## Misc
   
   <!-- ADD RELATED ISSUE ID WHEN APPLICABLE -->
   
   - [ ] The API has been changed (apache/echarts-doc#xxx).
   - [ ] This PR depends on ZRender changes (ecomfe/zrender#xxx).
   
   ### Related test cases or examples to use the new APIs
   
   N.A.
   
   
   
   ## Others
   
   ### Merging options
   
   - [ ] Please squash the commits into a single one when merging.
   
   ### Other information
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] pissang commented on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1058834715


   @Ovilia has updated the package-lock.json to the latest 2.0 in the release branch. Perhaps we can leave this PR to be merged after merging release to master


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] susiwen8 commented on a change in pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#discussion_r821771140



##########
File path: build/dev-fast.js
##########
@@ -20,21 +20,20 @@
 
 const path = require('path');
 const {build} = require('esbuild');
-const commander = require('commander');
 const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
 
 const umdWrapperHead = `(function (root, factory) {
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
         define(['exports'], factory);
-    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
+    } else if (typeof module === 'object' && typeof module.nodeName !== 'string') {
         // CommonJS
-        factory(exports);

Review comment:
       The reason why I have change `exports` to `module` is that `esbuild` generate `module.exports = ___toCommonJS(****)` at the end of file if we chose `cjs` format.
   Cause in browser environment, `module` is not a global variable as in `node`.  It will throw `module is not defined` in browser.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] pissang commented on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1060325180


   package-lock.json in the master branch has been updated.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] pissang commented on a change in pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
pissang commented on a change in pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#discussion_r819212605



##########
File path: test/lib/simpleRequire.js
##########
@@ -142,7 +142,7 @@
                 var factoryRet = factory.apply(null, deps.map(function (dep) {
                     return dep === exportsPlaceholder ? modExports : dep;
                 }));
-                return factoryRet || modExports;
+                return factoryRet || modExports.exports || modExports;

Review comment:
       Could you explain this change to me? I think this is not same with the AMD spec

##########
File path: build/dev-fast.js
##########
@@ -20,21 +20,20 @@
 
 const path = require('path');
 const {build} = require('esbuild');
-const commander = require('commander');
 const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
 
 const umdWrapperHead = `(function (root, factory) {
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
         define(['exports'], factory);
-    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
+    } else if (typeof module === 'object' && typeof module.nodeName !== 'string') {
         // CommonJS
-        factory(exports);

Review comment:
       Change `exports` to `module` may behave differently in the CommonJS environment. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] pissang edited a comment on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
pissang edited a comment on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1058834715


   @Ovilia has updated the package-lock.json to  2.0 in the release branch. Perhaps we can leave this PR to be merged after merging release to master


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] susiwen8 commented on a change in pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#discussion_r821774562



##########
File path: build/dev-fast.js
##########
@@ -20,21 +20,20 @@
 
 const path = require('path');
 const {build} = require('esbuild');
-const commander = require('commander');
 const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
 
 const umdWrapperHead = `(function (root, factory) {
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
         define(['exports'], factory);
-    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
+    } else if (typeof module === 'object' && typeof module.nodeName !== 'string') {
         // CommonJS
-        factory(exports);

Review comment:
       @plainheart Well, Same error if we use `rollup` header




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] echarts-bot[bot] commented on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1058064434


   Thanks for your contribution!
   The community will review it ASAP. In the meanwhile, please checkout [the coding standard](https://echarts.apache.org/en/coding-standard.html) and Wiki about [How to make a pull request](https://github.com/apache/echarts/wiki/How-to-make-a-pull-request).
   
   The pull request is marked to be `PR: author is committer` because you are a committer of this project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] susiwen8 commented on a change in pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#discussion_r821788867



##########
File path: build/dev-fast.js
##########
@@ -20,21 +20,20 @@
 
 const path = require('path');
 const {build} = require('esbuild');
-const commander = require('commander');
 const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
 
 const umdWrapperHead = `(function (root, factory) {
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
         define(['exports'], factory);
-    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
+    } else if (typeof module === 'object' && typeof module.nodeName !== 'string') {
         // CommonJS
-        factory(exports);

Review comment:
       JS spec is not my area of expertise. To be honestly, I'm still confused by [esbuild](https://github.com/evanw/esbuild/pull/1849)




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] susiwen8 commented on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1058854386


   > @Ovilia has updated the package-lock.json to the latest 2.0 in the release branch. Perhaps we can leave this PR to be merged after merging release to master
   
   Ok


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] pissang commented on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
pissang commented on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1058763494


   `package-lock.json` needs to be updated


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] susiwen8 commented on a change in pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on a change in pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#discussion_r821783026



##########
File path: test/lib/simpleRequire.js
##########
@@ -142,7 +142,7 @@
                 var factoryRet = factory.apply(null, deps.map(function (dep) {
                     return dep === exportsPlaceholder ? modExports : dep;
                 }));
-                return factoryRet || modExports;
+                return factoryRet || modExports.exports || modExports;

Review comment:
       Well, `modExports` would be an argument for `factory` function, as matter of fact, variable `modExports` will be variable `module` when function runs. Then as I have mention above, The `exports` attribute of `module` will have whatever  `echarts`  have exported. 
   ```js
   modExports = {
       exports: echarts.
   }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] plainheart commented on a change in pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
plainheart commented on a change in pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#discussion_r821400905



##########
File path: build/dev-fast.js
##########
@@ -20,21 +20,20 @@
 
 const path = require('path');
 const {build} = require('esbuild');
-const commander = require('commander');
 const outFilePath = path.resolve(__dirname, '../dist/echarts.js');
 
 const umdWrapperHead = `(function (root, factory) {
     if (typeof define === 'function' && define.amd) {
         // AMD. Register as an anonymous module.
         define(['exports'], factory);
-    } else if (typeof exports === 'object' && typeof exports.nodeName !== 'string') {
+    } else if (typeof module === 'object' && typeof module.nodeName !== 'string') {
         // CommonJS
-        factory(exports);

Review comment:
       As for the UMD header, it may be better to use the same block with rollup. 
   ```js
   (function (global, factory) {
       typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
       typeof define === 'function' && define.amd ? define(['exports'], factory) :
       (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.echarts = {}));
   }(this, (function (exports) {
       // ...
   })));
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] susiwen8 commented on pull request #16619: dev-build: update esbuild

Posted by GitBox <gi...@apache.org>.
susiwen8 commented on pull request #16619:
URL: https://github.com/apache/echarts/pull/16619#issuecomment-1058772500


   > `package-lock.json` needs to be updated
   
   @pissang  I'm concerned about package.lock.json. Casue my lockfile version is not same with previous. I remember @plainheart have disscuess with you.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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