diff --git a/package.json b/package.json index 0cfd949..7be0ed1 100644 --- a/package.json +++ b/package.json @@ -16,16 +16,9 @@ "vite-plugin", "vite-plugin-graphql-codegen" ], - "main": "./dist/index.js", - "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "require": "./dist/index.js", - "import": "./dist/index.mjs", - "types": "./dist/index.d.ts" - } - }, + "type": "commonjs", + "main": "dist/index.js", + "types": "dist/index.d.ts", "files": [ "dist" ], diff --git a/tsup.config.ts b/tsup.config.ts index 6cd7215..42ba6a3 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -6,5 +6,14 @@ export default defineConfig({ sourcemap: true, clean: true, skipNodeModulesBundle: true, - format: ['cjs', 'esm'], + format: ['cjs'], + esbuildOptions: (options) => { + options.footer = { + // This will ensure we can continue writing this plugin + // as a modern ECMA module, while still publishing this as a CommonJS + // library with a default export, as that's how ESLint expects plugins to look. + // @see https://github.com/evanw/esbuild/issues/1182#issuecomment-1011414271 + js: 'module.exports = module.exports.default;', + }; + }, });