打包报错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(),
]


相关文章
|
7月前
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
webpack 使用打包报错 ERROR in node_modules\@types\node\ts4.8\assert.d.ts
512 0
|
JavaScript
Vue报错:This dependency was not found: vuex in ./node_modules/babel-loader/lib
Vue报错:This dependency was not found: vuex in ./node_modules/babel-loader/lib
1175 0
Vue报错:This dependency was not found: vuex in ./node_modules/babel-loader/lib
|
7月前
报错/ ./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)怎么解决?
|
4月前
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
error in ./node_modules/@intlify/core-base/dist/core-base.cjs
120 2
|
资源调度
Cannot find module ‘\node_modules\ejs\postinstall.js
Cannot find module ‘\node_modules\ejs\postinstall.js
148 0
|
7月前
Module build failed (from ./node_modules/eslint-loader/index.js)
Module build failed (from ./node_modules/eslint-loader/index.js)
200 0
Module build failed (from ./node_modules/eslint-loader/index.js)
|
7月前
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.
83 2
node Express.js node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module ‘
node Express.js node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module ‘
1129 0
node Express.js node:internal/modules/cjs/loader:988 throw err; ^ Error: Cannot find module ‘
|
JavaScript
Node.js Error: Cannot find module express
Node.js Error: Cannot find module express
133 1
|
7月前
./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问题