Error: 'default' is not exported by node_modules\jquery\dist\jquery.js, imported by node_modules\bootstrap\js\src\util.js


問題描述:

在使用rollup編譯es6時,遇到報錯Error: 'default' is not exported by node_modules\jquery\dist\jquery.js, imported by node_modules\bootstrap\js\src\util.js問題

產生原因:

  • 腳本使用了jquery.js是以commonjs模塊的形式出現的

解決方案:

  • 安裝@rollup/plugin-commonjs插件

          npm install @rollup/plugin-commonjs --save-dev

 

      最后,修改rollup.config.js文件中

      import commonjs from '@rollup/plugin-commonjs'

      plugins: [
            commonjs(),
      ]


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM