About export and import commands in ES6module

  1. is to see the demo code in Ruan Yifeng"s ES6
  2. clipboard.png

clipboard.png


clipboard.png

  1. clipboard.png

  2. bablees5

    clipboard.png

question: 1. So you have to use module.exports and require? to use module. two If you follow the above method, it is not still to import the whole module and then read specific properties from the module, but I think Ruan Yifeng"s tutorial only loads import?


  1. so you must use module.exports and require? in module

first of all, you are nodejs . import-export is supported above 8, but add running parameters and change to .mjs . For more information, please see the official website.

2. If you follow the above method, it is not still to import the whole module and then read specific properties from the module, but I think Ruan Yifeng's tutorial only loads import?

< del > as far as I know, both require and import are imported into the whole module , which is the require implementation of nodejs and the import specification of ES6 , let {foo,bar} =. is just a deconstruction syntax. < / del >

reference link MDN import

Given an object or value named myExport which has been exported from the module my-module either implicitly ( because the entire module is exported ) or explicitly (using the export statement), this inserts myExport into the current scope.
import {myExport} from '/modules/my-module.js';

import line do not know, but I know that export is not good
you can try this kind of problem practice


you can try to run in the babel environment, the current browser should not directly support import , export syntax.


chrome 61 starts trying to directly support ES-Next 's import-export, in browsers
I have a simple example
https://shy2850.github.io/mus.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5a0d3-44ac4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5a0d3-44ac4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?