Skip to content
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

fix(nextjs): Add back browser field in package.json #6809

Merged
merged 4 commits into from
Jan 17, 2023
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: 4 additions & 3 deletions packages/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"engines": {
"node": ">=8"
},
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"main": "build/cjs/index.server.js",
"module": "build/esm/index.server.js",
"browser": "build/esm/index.client.js",
"types": "build/types/index.types.d.ts",
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -54,7 +55,7 @@
"build:transpile:watch": "nodemon --ext ts --watch src scripts/buildRollup.ts",
"build:types:watch": "tsc -p tsconfig.types.json --watch",
"build:tarball": "ts-node ../../scripts/prepack.ts && npm pack ./build",
"circularDepCheck": "madge --circular src/index.ts && madge --circular src/client/index.ts && madge --circular src/index.types.ts",
"circularDepCheck": "madge --circular src/index.client.ts && madge --circular src/edge/index.ts && madge --circular src/index.server.ts && madge --circular src/index.types.ts",
"clean": "rimraf build coverage sentry-nextjs-*.tgz",
"fix": "run-s fix:eslint fix:prettier",
"fix:eslint": "eslint . --format stylish --fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/rollup.npm.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default [
makeBaseNPMConfig({
// We need to include `instrumentServer.ts` separately because it's only conditionally required, and so rollup
// doesn't automatically include it when calculating the module dependency tree.
entrypoints: ['src/index.ts', 'src/client/index.ts', 'src/edge/index.ts', 'src/config/webpack.ts'],
entrypoints: ['src/index.server.ts', 'src/index.client.ts', 'src/edge/index.ts', 'src/config/webpack.ts'],

// prevent this internal nextjs code from ending up in our built package (this doesn't happen automatially because
// the name doesn't match an SDK dependency)
Expand Down
6 changes: 6 additions & 0 deletions packages/nextjs/src/index.client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './client';

// This file is the main entrypoint for non-Next.js build pipelines that use
// the package.json's "browser" field or the Edge runtime (Edge API routes and middleware)

// __SENTRY_SDK_MULTIPLEXER__
6 changes: 6 additions & 0 deletions packages/nextjs/src/index.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export * from './config';
export * from './server';

// This file is the main entrypoint on the server and/or when the package is `require`d

// __SENTRY_SDK_MULTIPLEXER__
4 changes: 0 additions & 4 deletions packages/nextjs/src/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/nextjs/test/serverSdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Integration } from '@sentry/types';
import { GLOBAL_OBJ, logger } from '@sentry/utils';
import * as domain from 'domain';

import { init } from '../src/index';
import { init } from '../src/server';

const { Integrations } = SentryNode;

Expand Down