就写个例子,
math.mjs
export default (a, b) => {
return a + b;
}
index.mjs
import add from './math.mjs'
let ret = add(1, 2)
console.log(ret)
node --experimental-modules index.mjs
就写个例子,
math.mjs
export default (a, b) => {
return a + b;
}
index.mjs
import add from './math.mjs'
let ret = add(1, 2)
console.log(ret)
node --experimental-modules index.mjs
本文标题:如何在 Nodejs 中用上 ESModules
本文链接:https://www.haomeiwen.com/subject/xwlopctx.html
网友评论