Skip to content

Commit

Permalink
build(server): try migrating to esbuild
Browse files Browse the repository at this point in the history
This is currently not possible, since esbuild has no support for top
level await when bundling to cjs.
See evanw/esbuild#253
  • Loading branch information
p-98 committed Jun 5, 2024
1 parent aa8aab2 commit a6f6fa3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@
"@graphql-eslint/eslint-plugin": "^3.10.3",
"@graphql-tools/executor-http": "1.0.2",
"@graphql-tools/jest-transform": "^1.2.2",
"@graphql-tools/optimize": "^2.0.0",
"@graphql-tools/utils": "10.0.6",
"@jest/globals": "^29.5.0",
"@luckycatfactory/esbuild-graphql-loader": "^3.8.1",
"@storybook/addon-actions": "~6.3.8",
"@storybook/addon-essentials": "~6.3.8",
"@storybook/addon-links": "~6.3.8",
Expand Down Expand Up @@ -127,6 +129,8 @@
"chai": "^4.3.7",
"clean-webpack-plugin": "^3.0.0",
"cookie": "^0.5.0",
"esbuild": "0.21.4",
"esbuild-plugin-eslint": "^0.3.12",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-next": "^14.1.3",
Expand All @@ -138,6 +142,7 @@
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0",
"fork-ts-checker-webpack-plugin": "^6.1.0",
"graphql-tag": "^2.12.6",
"html-webpack-plugin": "^5.3.1",
"jest": "^29.7.0",
"patch-package": "^8.0.0",
Expand Down
15 changes: 15 additions & 0 deletions server/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import esbuild from "esbuild";
import graphqlLoaderPlugin from "@luckycatfactory/esbuild-graphql-loader";
console.log(graphqlLoaderPlugin);
import { optimizeDocumentNode } from "@graphql-tools/optimize";

await esbuild.build({
entryPoints: ["./src/index.ts"],
outdir: "./out",
bundle: false,
minify: true,
platform: "node",
target: "node18.19.1",
packages: "external",
plugins: [graphqlLoaderPlugin({ mapDocumentNode: optimizeDocumentNode })],
});

0 comments on commit a6f6fa3

Please sign in to comment.