
【解决 SyntaxError: Cannot use import statement outside a module 报错问题】
1. JavaScript 的两种模块:ES6 模块(ESM)和 CommonJS 模块(CJS)。2. CommonJS 模块使用 require() 和 module.exports,ES6 模块使用 import 和 export。3. ES6 模块与 CommonJS 模块的差异。4. Node.js 的模块加载方法:CommonJS 模块是 Node.js 专用。从 Node.js v13.2 版本开始,Node.js 默认打开了 ES6 模块支持。













