打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js

简介: 打包报错Error: ‘default‘ is not exported by node_modules/qs/lib/index.js

问题描述:

当我们在使用rollup编译es6时,可能会遇到以下报错问题

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

解决方案:

  • 安装@rollup/plugin-commonjs插件
npm install @rollup/plugin-commonjs --save-dev

最后,修改rollup.config.js文件中写入以下代码即可

import commonjs from '@rollup/plugin-commonjs'
plugins: [
   commonjs(),
]


相关文章
|
JavaScript
Syntax Error: Error: Cannot find module ‘node-sass‘
Syntax Error: Error: Cannot find module ‘node-sass‘
313 0
|
6月前
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
408 0
|
6月前
报错/ ./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2)怎么解决?
报错/ ./node_modules/axios/lib/platform/index.js Module parse failed: Unexpected token (5:2)怎么解决?
|
3月前
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
90 2
|
资源调度
Cannot find module ‘\node_modules\ejs\postinstall.js
Cannot find module ‘\node_modules\ejs\postinstall.js
131 0
|
6月前
vue2项目安装出现Syntax Error: Error: Cannot find module ‘less‘
vue2项目安装出现Syntax Error: Error: Cannot find module ‘less‘
90 0
|
6月前
Module build failed (from ./node_modules/eslint-loader/index.js)
Module build failed (from ./node_modules/eslint-loader/index.js)
188 0
Module build failed (from ./node_modules/eslint-loader/index.js)
|
6月前
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
Angular启动/node_modules/@types/node/index.d.ts (20,1): Invalid ‘reference‘ directive syntax.
76 2
|
JavaScript
Node.js Error: Cannot find module express
Node.js Error: Cannot find module express
|
6月前
./node_modules/vue-qr/dist/vue-qr.js报错You may need an appropriate loader to handle this file type问题
./node_modules/vue-qr/dist/vue-qr.js报错You may need an appropriate loader to handle this file type问题