Skip to content

Commit 341ea81

Browse files
authored
document typescript module resolution (#583)
1 parent 1fcd313 commit 341ea81

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

docs/_fragments/_decorator-info.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ Using legacy decorators requires to use a transpiler such as [TypeScript](https:
1313
[Babel](https://babeljs.io/docs/babel-plugin-proposal-decorators) or others to compile them to JavaScript.
1414
Alternatively, Sequelize also supports [a legacy approach](../other-topics/legacy-model-definitions.mdx) that does not require using decorators, but this is discouraged.
1515

16+
If you're using TypeScript, you will also need to configure it to be able to resolve this export, [see our Getting Started guide](../getting-started.mdx#typescript) for more information.
17+
1618
:::

docs/getting-started.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,18 @@ Head to the [Version Policy page](/releases) to know which versions of TypeScrip
9999
and make sure that the [`@types/node`](https://www.npmjs.com/package/@types/node) package corresponding to your Node.js version is installed
100100
in your project.
101101

102+
:::info
103+
104+
Sequelize makes use of the the [`exports`](https://nodejs.org/api/packages.html#exports) `package.json` field.
105+
You may need to update your `tsconfig.json` configuration to make sure TypeScript's module resolution supports it.
106+
107+
At time of writing (TS 5.4), this can be done in two ways:
108+
109+
- Set [`moduleResolution`](https://www.typescriptlang.org/tsconfig#moduleResolution) to `node16`, `nodenext`, or `bundler`,
110+
- or set [`resolvePackageJsonExports`](https://www.typescriptlang.org/tsconfig#resolvePackageJsonExports) to `true`.
111+
112+
:::
113+
102114
## CommonJS or ESM?
103115

104116
Our documentation makes heavy use of ECMAScript Modules (ESM), but CommonJS is fully supported by Sequelize.

0 commit comments

Comments
 (0)