File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 " vite-plugin" ,
1818 " vite-plugin-graphql-codegen"
1919 ],
20- "type" : " commonjs" ,
21- "main" : " dist/index.js" ,
22- "types" : " dist/index.d.ts" ,
20+ "type" : " module" ,
21+ "exports" : " ./dist/index.js" ,
22+ "main" : " ./dist/index.cjs" ,
23+ "types" : " ./dist/index.d.ts" ,
2324 "files" : [
2425 " dist"
2526 ],
Original file line number Diff line number Diff line change @@ -6,14 +6,16 @@ export default defineConfig({
66 sourcemap : true ,
77 clean : true ,
88 skipNodeModulesBundle : true ,
9- format : [ 'cjs' ] ,
9+ format : [ 'cjs' , 'esm' ] ,
1010 esbuildOptions : ( options ) => {
11- options . footer = {
12- // This will ensure we can continue writing this plugin
13- // as a modern ECMA module, while still publishing this as a CommonJS
14- // library with a default export, as that's how ESLint expects plugins to look.
15- // @see https://github.com/evanw/esbuild/issues/1182#issuecomment-1011414271
16- js : 'module.exports = module.exports.default;' ,
17- } ;
11+ if ( options . format === 'cjs' ) {
12+ options . footer = {
13+ // This will ensure we can continue writing this plugin
14+ // as a modern ECMA module, while still publishing this as a CommonJS
15+ // library with a default export, as that's how ESLint expects plugins to look.
16+ // @see https://github.com/evanw/esbuild/issues/1182#issuecomment-1011414271
17+ js : 'module.exports = module.exports.default;' ,
18+ } ;
19+ }
1820 } ,
1921} ) ;
You can’t perform that action at this time.
0 commit comments