rollup.config.js
function fixAcornEsmImport() {
	return {
		name: 'fix-acorn-esm-import',
		renderChunk(code, chunk, options) {
			if (/esm?/.test(options.format)) {
				let found = false;
				const fixedCode = code.replace(expectedAcornImport, () => {
					found = true;
					return newAcornImport;
				});
				if (!found) {
					this.error(
						'Could not find expected acorn import, please deactive this plugin and examine generated code.'
					);
				}
				return fixedCode;
			}
		}
	};
}
function fixAcornEsmImport() {
	return {
		name: 'fix-acorn-esm-import',
		renderChunk(code, chunk, options) {
			if (/esm?/.test(options.format)) {
				let found = false;
				const fixedCode = code.replace(expectedAcornImport, () => {
					found = true;
					return newAcornImport;
				});
				if (!found) {
					this.error(
						'Could not find expected acorn import, please deactive this plugin and examine generated code.'
					);
				}
				return fixedCode;
			}
		}
	};
}
function fixAcornEsmImport ( ) { return { name : 'fix-acorn-esm-import' , renderChunk ( code , chunk , options ) { if ( / esm? / . test ( options . format ) ) { let found = false ; const fixedCode = code . replace ( expectedAcornImport , ( ) => { found = true ; return newAcornImport ; } ) ; if ( ! found ) { this . error ( 'Could not find expected acorn import, please deactive this plugin and examine generated code.' ) ; } return fixedCode ; } } } ; }
by default, rollup-plugin-commonjs will translate require statements as default imports which can cause issues for secondary tools that use the ESM version of acorn
by default rollup - plugin - commonjs will translate require statements as default imports which can cause issues for secondary tools that use the ESM version of acorn