Skip to content

Commit

Permalink
fix(angular-ivy): Add exports field to package.json (#10569)
Browse files Browse the repository at this point in the history
Add an `exports` field to the `package.json` for
`@sentry/angular-ivy`. While it seems like regular Angular apps didn't
need it, tools like `vitest` expect the field as soon as `type:
"module"` is specified.

---

Co-authored-by: Andrei Alecu <aandrei03@gmail.com>
  • Loading branch information
Lms24 and andreialecu committed Feb 12, 2024
1 parent cbd6721 commit 13f7dc8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/angular-ivy/scripts/prepack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type PackageJson = {
type?: string;
nx?: string;
volta?: any;
exports?: Record<string, string | Record<string, string>>;
};

const buildDir = path.join(process.cwd(), 'build');
Expand All @@ -18,6 +19,18 @@ const pkgJson: PackageJson = JSON.parse(fs.readFileSync(pkjJsonPath).toString())
delete pkgJson.main;
pkgJson.type = 'module';

pkgJson.exports = {
'.': {
es2015: './fesm2015/sentry-angular-ivy.js',
esm2015: './esm2015/sentry-angular-ivy.js',
fesm2015: './fesm2015/sentry-angular-ivy.js',
import: './fesm2015/sentry-angular-ivy.js',
require: './bundles/sentry-angular-ivy.umd.js',
types: './sentry-angular-ivy.d.ts',
},
'./*': './*',
};

// no need to keep around other properties that are only relevant for our reop:
delete pkgJson.nx;
delete pkgJson.volta;
Expand Down

0 comments on commit 13f7dc8

Please sign in to comment.