Skip to content

Commit

Permalink
fix: throw error when not using server import
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheyenbrock committed Feb 7, 2022
1 parent f93ce11 commit 27629d6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ build
public/build
.env

*.d.ts
index.server.js
dist
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
throw new Error(
'Can\'t import from "remix-graphql" directly, use "remix-graphql/index.server" instead'
);
1 change: 1 addition & 0 deletions index.server.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./dist";
1 change: 1 addition & 0 deletions index.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require("./dist/index.js");
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@
"type": "git",
"url": "https://github.com/thomasheyenbrock/remix-graphql.git"
},
"main": "index.server.js",
"types": "index.server.d.ts",
"main": "index.js",
"types": "dist/index.d.ts",
"author": "Thomas Heyenbrock <[email protected]>",
"license": "MIT",
"files": [
"dist",
"index.js",
"index.server.js",
"*.d.ts"
"index.server.d.ts"
],
"scripts": {
"build": "yarn build:clean && yarn build:code && yarn build:types",
"build:clean": "rm -f *.d.ts index.server.js",
"build:code": "esbuild src/index.server.ts --bundle --platform=node --external:graphql --external:graphql-helix --external:remix --outfile=index.server.js",
"build:clean": "rm -rf dist",
"build:code": "esbuild src/index.ts --bundle --platform=node --external:graphql --external:graphql-helix --external:remix --outfile=dist/index.js",
"build:types": "tsc",
"format": "prettier --write .",
"prepare": "install-peers && remix setup node"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"target": "ESNext",
"strict": true,
"baseUrl": "src",
"outDir": ".",
"outDir": "dist",
"declaration": true,
"emitDeclarationOnly": true
}
Expand Down

0 comments on commit 27629d6

Please sign in to comment.