在es6下用es6的,比如vue的脚手架里
在commonjs里用commonjs的,比如webpack,node里
es6
export default xxx export xxx import xxx from './xxx.js' import * as xxx from './xxx.js'
commonjs
module.exports = xxx exports xxx = xxx require('./xxx.js') require('xxx') let xxx = require('./xxx')