Skip to content

Instantly share code, notes, and snippets.

@EvanHahn
Last active April 18, 2024 17:59
Show Gist options
  • Save EvanHahn/d8a353ef88376072371a1b8a02876e7d to your computer and use it in GitHub Desktop.
Save EvanHahn/d8a353ef88376072371a1b8a02876e7d to your computer and use it in GitHub Desktop.
/node_modules/
import foo from "./other_module.js";
// Triggers the shim
require();
/* Causes the bug:
import BAD from "./bad";
*/
console.log(foo());
export default function foo() {
return 123;
}
{
"private": true,
"type": "module",
"scripts": {
"build": "rollup -c rollup.config.js"
},
"devDependencies": {
"@rollup/plugin-esm-shim": "^0.1.6",
"rollup": "^4.14.3"
}
}
import esmShim from "@rollup/plugin-esm-shim";
export default {
input: "bug.js",
output: {
file: "/dev/stdout",
format: "es",
},
plugins: [esmShim()],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment