模块化导出

打包,函数导出(模块化)

例子
App:

// app.js
import { add } from './math.js';

console.log(add(16, 26)); // 42
// math.js
export function add(a, b) {
  return a + b;
}
Bundle:

function add(a, b) {
  return a + b;
}

console.log(add(16, 26)); // 42

猜你喜欢

转载自www.cnblogs.com/winyh/p/9318471.html