参考文档

https://babeljs.io/docs/en/babel-plugin-syntax-dynamic-import/

https://babeljs.io/docs/en/configuration

1. 安装

  1.  
    npm install --save-dev @babel/plugin-syntax-dynamic-import

2.使用

      1. 通过 .babelrc (推荐)

  1.  
    // JSON
  2.  
    module.exports = {
  3.  
    presets: ['@vue/app'],
  4.  
    plugins: ['@babel/plugin-syntax-dynamic-import']
     
    }
    import('./a.js').then(()=>{
      console.log('a.js is loaded dynamically');
    });
    

      

相关文章:

  • 2021-11-30
  • 2022-12-23
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-08-31
猜你喜欢
  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案