Error: ‘default’ is not exported by node_ modules/qs/lib/ index.js

Phenomenon: Recently, when using rollup to develop small JS plug-ins, an error was reported during packaging: error: ‘default’ is not exported by node_ modules/qs/lib/ index.js .

Reason: I use the QS package to format. After installing the QS dependency, I introduce the import QS from ‘QS’, but the package will report an error. Because QS is in the form of commonjs module, which is also mentioned in the official rollup document, as shown in the figure below, the rollup plugin commonjs plug-in should be introduced. Refer to the rollup plugin commonjs document https://github.com/rollup/rollup-plugin-commonjs

reference resources:

Rollup | resolve error report error: ‘__ moduleExports’ is not exported by xxxx

Rollup official document

Read More: