Skip to content

Commit

Permalink
fix: change import structure for client/server
Browse files Browse the repository at this point in the history
* Importing the root index in the browser causes server code to be
  included in the remix browser bundle, causing an error with
  fs/promises.

* Fixed this by seperating the `dist` into a `client` and `server`
  • Loading branch information
dan-cooke committed Dec 5, 2022
1 parent de715a0 commit ed3419c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 8 deletions.
1 change: 1 addition & 0 deletions .releaserc
Expand Up @@ -3,6 +3,7 @@ branches:
debug: true
ci: true
dryRun: false
pkgRoot: 'dist'
plugins:
- '@semantic-release/commit-analyzer'
- '@semantic-release/release-notes-generator'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -44,7 +44,7 @@ export const loader: LoaderFunction = ({ request }) => {
2. Call the `useEventSource` hook in the browser to start receiving events.

````.ts
import { useEventSource } from 'remix-sse'
import { useEventSource } from 'remix-sse/client'

const data = useEventSource('/emitter');

Expand Down
10 changes: 4 additions & 6 deletions package.json
Expand Up @@ -2,13 +2,11 @@
"name": "remix-sse",
"version": "1.0.1",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/"
],
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build": "tsc",
"postbuild": "cp package.json dist",
"dev": "tsc -w",
"lint": "eslint src/**/*.{ts,tsx}",
"test": "echo \"todo\""
Expand Down Expand Up @@ -66,4 +64,4 @@
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}
}
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion src/core.tsx
@@ -1,2 +1 @@
export * from './hooks';
export * from './server';

0 comments on commit ed3419c

Please sign in to comment.