Skip to content

Commit

Permalink
[plugin-code-exporter/plugin-explorer]: exclude peer dependencies and…
Browse files Browse the repository at this point in the history
… dependencies from bundle (#3229)
  • Loading branch information
dimaMachina committed Jun 17, 2023
1 parent 67bf93a commit 0a65e72
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .changeset/little-stingrays-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@graphiql/plugin-code-exporter': patch
'@graphiql/plugin-explorer': patch
---

exclude peer dependencies and dependencies from bundle
4 changes: 2 additions & 2 deletions packages/graphiql-plugin-code-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
9 changes: 7 additions & 2 deletions packages/graphiql-plugin-code-exporter/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import packageJSON from './package.json';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react({ jsxRuntime: 'classic' })],
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: {
Expand Down
4 changes: 2 additions & 2 deletions packages/graphiql-plugin-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
9 changes: 7 additions & 2 deletions packages/graphiql-plugin-explorer/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import packageJSON from './package.json';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react({ jsxRuntime: 'classic' })],
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: {
Expand Down

0 comments on commit 0a65e72

Please sign in to comment.