前文: 2018-08-28-js模块化, 摆脱玩具语言的定位的阅读笔记.md

前文说道, es6的模块方案是目前已知的最佳实践, 那么, 我们如何使用呢? 尤其是nodejs.

万能的stackoverflow
  • https://stackoverflow.com/questions/45854169/how-can-i-use-an-es6-import-in-node
  • 做两件事就可以了:
    • 文件命名为mjs
    • 运行时: node –experimental-modules index.mjs
  • 这个个更清晰: https://stackoverflow.com/questions/37132031/nodejs-plans-to-support-import-export-es6-es2015-modules
    • 不仅仅讲了方法. 还讲了缘由.
    • 而且还讲了历史, 类似node如何引入es6的log.
怎么知道支持程度
npm install -g es-checker
es-checker