src中新建a.js写入
//几种导出方式
let a = "yuchunhui"
//export default a
//export {a}
module.exports = a
//index.js中写入
//对应的导入方式
//import x from "./a.js"
//import {a as x} from "./a.js"
const x = require("./a.js")
console.log(x);
//打包
npx webpack
src中新建a.js写入
//几种导出方式
let a = "yuchunhui"
//export default a
//export {a}
module.exports = a
//index.js中写入
//对应的导入方式
//import x from "./a.js"
//import {a as x} from "./a.js"
const x = require("./a.js")
console.log(x);
//打包
npx webpack