File tree Expand file tree Collapse file tree 6 files changed +4448
-9637
lines changed
Expand file tree Collapse file tree 6 files changed +4448
-9637
lines changed Original file line number Diff line number Diff line change 2828 cd ./docs/
2929 pm2 restart graphql-debugger.com
3030 cd ../apps/ui
31- DEMO_MODE=true pnpm build
31+ NODE_ENV=production DEMO_MODE=true pnpm build
3232 pm2 restart demo
Original file line number Diff line number Diff line change 1818 "dev" : " cross-env TRACE_SCHEMA=true TRACE_PRISMA=true TRACE_EXPRESS=true ts-node ./src/main.ts"
1919 },
2020 "dependencies" : {
21- "@graphql-debugger/client" : " workspace:^" ,
2221 "@graphql-debugger/adapter-sqlite" : " workspace:^" ,
22+ "@graphql-debugger/client" : " workspace:^" ,
2323 "@graphql-debugger/graphql-schema" : " workspace:^" ,
2424 "@graphql-debugger/plugin-express" : " workspace:^" ,
2525 "@graphql-debugger/ui" : " workspace:^" ,
2626 "@graphql-debugger/utils" : " workspace:^" ,
2727 "cors" : " 2.8.5" ,
28- "express" : " 4.19.2"
28+ "express" : " 4.19.2" ,
29+ "express-static-gzip" : " 2.1.7"
2930 },
3031 "devDependencies" : {
3132 "@types/cors" : " 2.8.17" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { graphqlDebugger } from "@graphql-debugger/plugin-express";
44
55import cors from "cors" ;
66import express , { Express } from "express" ;
7+ import expressStaticGzip from "express-static-gzip" ;
78import http from "http" ;
89import path from "path" ;
910
@@ -30,7 +31,12 @@ export async function start({
3031 client,
3132 } ) ,
3233 ) ;
33- app . use ( express . static ( path . join ( __dirname , "../../ui/build" ) ) ) ;
34+ app . use (
35+ "/" ,
36+ expressStaticGzip ( path . join ( __dirname , "../../ui/build" ) , {
37+ enableBrotli : true ,
38+ } ) ,
39+ ) ;
3440 app . use ( express . static ( "public" ) ) ;
3541
3642 const server = await app . listen ( port ) ;
Original file line number Diff line number Diff line change 4747 },
4848 "devDependencies" : {
4949 "@faker-js/faker" : " 8.4.1" ,
50- "@graphql-debugger/types" : " workspace:^"
50+ "@graphql-debugger/types" : " workspace:^" ,
51+ "compression-webpack-plugin" : " 11.1.0"
5152 },
5253 "engines" : {
5354 "node" : " >=18" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
44const CopyWebpackPlugin = require ( "copy-webpack-plugin" ) ;
55const { CleanWebpackPlugin } = require ( "clean-webpack-plugin" ) ;
66const NodePolyfillPlugin = require ( "node-polyfill-webpack-plugin" ) ;
7+ const CompressionPlugin = require ( "compression-webpack-plugin" ) ;
78
89module . exports = {
910 mode : "none" ,
@@ -73,6 +74,13 @@ module.exports = {
7374 favicon : "./public/favicon.svg" ,
7475 } ) ,
7576 new NodePolyfillPlugin ( ) ,
77+ ...( process . env . NODE_ENV === "production"
78+ ? [
79+ new CompressionPlugin ( {
80+ deleteOriginalAssets : true ,
81+ } ) ,
82+ ]
83+ : [ ] ) ,
7684 ] ,
7785 devServer : {
7886 static : {
You can’t perform that action at this time.
0 commit comments