// export var name = ‘foo module’
// export function hello () {
// console.log(‘hello’)
// }
// export class Person {}
var name = ‘foo module’
function hello () {
console.log(‘hello’)
}
class Person {}
// export { name, hello, Person }
// export {
// // name as default,
// hello as fooHello
// }
// export default name
// var obj = { name, hello, Person }
export { name, hello, Person }
app.js
默认值导出后需要命名
// import { default as fooName } from ‘./module.js’
// console.log(fooName)
import { name, hello, Person } from ‘./module.js’
console.log(name, hello, Person)