commonjs规范
1.创建模块 创建js文件
2.暴露模块 module.exports \ export default
3.加载模块 require \ import
4.使用模块
a.js
let a=20;
module.exports.a=a;
b.js
const a=require("./a")
console.log(a);
commonjs规范
1.创建模块 创建js文件
2.暴露模块 module.exports \ export default
3.加载模块 require \ import
4.使用模块
a.js
let a=20;
module.exports.a=a;
b.js
const a=require("./a")
console.log(a);