Skip to content

Commit

Permalink
fix: compile to commonjs (#369)
Browse files Browse the repository at this point in the history
Publishing `@guardian/cdk` in ESM format is tricky as additional tooling required by consumers such as [ts-node](TypeStrong/ts-node#1007) (see also [this](TypeStrong/ts-node#935)), [ESLint](eslint/rfcs#43) and [Jest](https://jestjs.io/docs/ecmascript-modules) have varying support.

It is easiest to stay on CommonJS.

We'll have to stay on v7.0.1 of `read-pkg-up` to achieve this; v8.0.0 doesn't bring any new features or fixes, so this is safe.
  • Loading branch information
akash1810 committed Mar 31, 2021
1 parent 2cc02c8 commit f8aebdf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 100 deletions.
132 changes: 36 additions & 96 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -62,7 +62,7 @@
"@aws-cdk/aws-s3": "1.94.1",
"@aws-cdk/core": "1.94.1",
"aws-sdk": "^2.868.0",
"read-pkg-up": "^8.0.0"
"read-pkg-up": "7.0.1"
},
"config": {
"commitizen": {
Expand Down
4 changes: 2 additions & 2 deletions src/constants/library-info.ts
@@ -1,6 +1,6 @@
import { readPackageUpSync } from "read-pkg-up";
import readPkgUp from "read-pkg-up";

const version = readPackageUpSync({ cwd: __dirname })?.packageJson.version ?? "unknown";
const version = readPkgUp.sync({ cwd: __dirname })?.packageJson.version ?? "unknown";

export const LibraryInfo = {
VERSION: version,
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "ES2020",
"module": "commonjs",
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
Expand Down

0 comments on commit f8aebdf

Please sign in to comment.