Search code examples
javascriptnode.jssinoncommonjsrollupjs

How can I bundle my tests which use Sinon.js using Rollup.js?


I'm using Rollup.js with plugins rollup-plugin-node-resolve and rollup-plugin-commonjs to bundle my tests, which use Sinon.js. When I try to run the bundled file I get the following error:

Error: Dynamic requires are not currently supported by rollup-plugin-commonjs

Is there any workaround for this error, or do I have to use some other tool like Webpack?


Solution

  • Sinon.js v1.x doesn't work with bundlers like Rollup.js. You should upgrade to a newer version (v2.x or later).