Replace unresolved imports.
import replaceImports from 'rollup-plugin-replace-imports';
export default {
input: 'src/index.js',
plugins: [
// ...
],
output: [
{
dir: 'dist',
format: 'cjs',
exports: 'auto',
plugins: [
replaceImports(n => n.replace('/es/', '/')),
],
},
{
dir: 'dist/es',
format: 'es',
exports: 'auto',
},
],
};