Skip to content

Commit

Permalink
simplify subpath example in nextjs
Browse files Browse the repository at this point in the history
  • Loading branch information
JReinhold committed Apr 17, 2024
1 parent 5d8ee28 commit 4faf1ae
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions docs/get-started/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,12 @@ export default function HomePage() {

As an alternative to [module aliases](#module-aliases), you can use [subpath imports](https://nodejs.org/api/packages.html#subpath-imports) to import modules. This follows Node package standards and has benefits when [mocking modules](#mocking-modules).

To configure subpath imports, you define the `imports` property in your project's `package.json` file. This property maps the subpath to the actual file path. The example below configures subpath imports for the `components` and `styles` internal modules:
To configure subpath imports, you define the `imports` property in your project's `package.json` file. This property maps the subpath to the actual file path. The example below configures subpath imports for all modules in the project:

```json
// package.json
{
"imports": {
"#components": "./components",
"#styles": "./styles",
"#*": ["./*", "./*.ts", "./*.tsx"]
}
}
Expand Down

0 comments on commit 4faf1ae

Please sign in to comment.