Vanilla Rollup can only support the ESM format. So one can either include rollup-plugin-commonjs
for upstream dependency. Or generate both UMD and ESM bundles for the base lib.
yarn rollup
creates ./src/index_rolledUp.js and ./src/index_rolledUp.mjs from ./src/index.js./src/indexSquared.js
uses./src/index_rolledUp.mjs
. Rollup will default to .mjs whenever available.yarn rollupSquared
to bundle ./dist/index.js
All based on this answer.
Thanks!