Skip to content

[vite] set build.minify: false for cjs/esm builds #3656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/tidy-fans-reflect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@graphiql/plugin-code-exporter": patch
"@graphiql/plugin-explorer": patch
"@graphiql/react": patch
---

set `build.minify: false` for cjs/esm builds since minified variable names change every build time
1 change: 1 addition & 0 deletions packages/graphiql-plugin-code-exporter/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const IS_UMD = process.env.UMD === 'true';
export default defineConfig({
plugins: [react({ jsxRuntime: 'classic' })],
build: {
minify: IS_UMD ? 'esbuild' : false,
// avoid clean cjs/es builds
emptyOutDir: !IS_UMD,
lib: {
Expand Down
1 change: 1 addition & 0 deletions packages/graphiql-plugin-explorer/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default defineConfig({
}),
],
build: {
minify: IS_UMD ? 'esbuild' : false,
// avoid clean cjs/es builds
emptyOutDir: !IS_UMD,
lib: {
Expand Down
6 changes: 1 addition & 5 deletions packages/graphiql-react/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ export default defineConfig({
plugins: [postCssNestingPlugin()],
},
},
esbuild: {
// We use function names for generating readable error messages, so we want
// them to be preserved when building and minifying.
keepNames: true,
},
build: {
minify: false,
sourcemap: true,
lib: {
entry: 'src/index.ts',
Expand Down
Loading