From b63bb230fa2d4ddbb61fdd9c0e9105395629ce20 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Wed, 14 Jun 2023 18:39:40 +0200 Subject: [PATCH] fix --- .changeset/little-stingrays-sin.md | 6 ++++++ packages/graphiql-plugin-code-exporter/package.json | 4 ++-- packages/graphiql-plugin-code-exporter/vite.config.ts | 9 +++++++-- packages/graphiql-plugin-explorer/package.json | 4 ++-- packages/graphiql-plugin-explorer/vite.config.ts | 9 +++++++-- 5 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 .changeset/little-stingrays-sin.md diff --git a/.changeset/little-stingrays-sin.md b/.changeset/little-stingrays-sin.md new file mode 100644 index 00000000000..fd8ca08bd36 --- /dev/null +++ b/.changeset/little-stingrays-sin.md @@ -0,0 +1,6 @@ +--- +'@graphiql/plugin-code-exporter': patch +'@graphiql/plugin-explorer': patch +--- + +exclude peer dependencies and dependencies from bundle diff --git a/packages/graphiql-plugin-code-exporter/package.json b/packages/graphiql-plugin-code-exporter/package.json index c43c603e9a4..8f55ae3b1d9 100644 --- a/packages/graphiql-plugin-code-exporter/package.json +++ b/packages/graphiql-plugin-code-exporter/package.json @@ -7,8 +7,8 @@ "directory": "packages/graphiql-plugin-code-exporter" }, "author": "LekoArts", - "main": "dist/graphiql-plugin-code-exporter.cjs.js", - "module": "dist/graphiql-plugin-code-exporter.es.js", + "main": "dist/index.cjs.js", + "module": "dist/index.es.js", "types": "types/index.d.ts", "license": "MIT", "keywords": [ diff --git a/packages/graphiql-plugin-code-exporter/vite.config.ts b/packages/graphiql-plugin-code-exporter/vite.config.ts index fba5851ea9a..9eb55f9d5df 100644 --- a/packages/graphiql-plugin-code-exporter/vite.config.ts +++ b/packages/graphiql-plugin-code-exporter/vite.config.ts @@ -1,5 +1,6 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +import packageJSON from './package.json'; // https://vitejs.dev/config/ export default defineConfig({ @@ -7,12 +8,16 @@ export default defineConfig({ build: { lib: { entry: 'src/index.tsx', - fileName: 'graphiql-plugin-code-exporter', + fileName: 'index', name: 'GraphiQLPluginCodeExporter', formats: ['cjs', 'es', 'umd'], }, rollupOptions: { - external: ['graphql', 'react', 'react-dom'], + external: [ + // Exclude peer dependencies and dependencies from bundle + ...Object.keys(packageJSON.peerDependencies), + ...Object.keys(packageJSON.dependencies), + ], output: { chunkFileNames: '[name].[format].js', globals: { diff --git a/packages/graphiql-plugin-explorer/package.json b/packages/graphiql-plugin-explorer/package.json index 042aeb53966..90f8cbed15a 100644 --- a/packages/graphiql-plugin-explorer/package.json +++ b/packages/graphiql-plugin-explorer/package.json @@ -6,8 +6,8 @@ "url": "https://github.com/graphql/graphiql", "directory": "packages/graphiql-plugin-explorer" }, - "main": "dist/graphiql-plugin-explorer.cjs.js", - "module": "dist/graphiql-plugin-explorer.es.js", + "main": "dist/index.cjs.js", + "module": "dist/index.es.js", "types": "types/index.d.ts", "license": "MIT", "keywords": [ diff --git a/packages/graphiql-plugin-explorer/vite.config.ts b/packages/graphiql-plugin-explorer/vite.config.ts index 314668946f1..97d1ec75be3 100644 --- a/packages/graphiql-plugin-explorer/vite.config.ts +++ b/packages/graphiql-plugin-explorer/vite.config.ts @@ -1,5 +1,6 @@ import { defineConfig } from 'vite'; import react from '@vitejs/plugin-react'; +import packageJSON from './package.json'; // https://vitejs.dev/config/ export default defineConfig({ @@ -7,12 +8,16 @@ export default defineConfig({ build: { lib: { entry: 'src/index.tsx', - fileName: 'graphiql-plugin-explorer', + fileName: 'index', name: 'GraphiQLPluginExplorer', formats: ['cjs', 'es', 'umd'], }, rollupOptions: { - external: ['@graphiql/react', 'graphql', 'react', 'react-dom'], + external: [ + // Exclude peer dependencies and dependencies from bundle + ...Object.keys(packageJSON.peerDependencies), + ...Object.keys(packageJSON.dependencies), + ], output: { chunkFileNames: '[name].[format].js', globals: {