|
1 | 1 | # Configuring OpenNext for use in an Nx Monorepo. |
2 | | -Here's a detailed exampled of how to add open-next + SST to an existing Nx workspace, with an existing NextJS application sitting at `apps/next-site` |
| 2 | +Here's a detailed exampled of how to add OpenNext + SST to an existing Nx workspace, with an existing NextJS application sitting at `apps/next-site` |
3 | 3 |
|
4 | | -1. install `open-next`: `pnpm add —save-dev open-next` |
| 4 | +1. install `open-next`: `pnpm add —save-dev @opennextjs/aws` |
5 | 5 |
|
6 | 6 | 2. Update your `apps/next-site/next.config.js` add `output: ‘standalone’`, and you want to add `experimental.outputFileTracingRoot`, it should look a little like this: |
7 | 7 | ```javascript |
@@ -35,9 +35,9 @@ const plugins = [ |
35 | 35 | module.exports = composePlugins(...plugins)(nextConfig); |
36 | 36 | ``` |
37 | 37 |
|
38 | | -3. Create `open-next.config.js` inside your apps root directory, it should look a little something like this: |
| 38 | +3. Create `open-next.config.ts` inside your apps root directory, it should look a little something like this: |
39 | 39 | ```javascript |
40 | | -import type { OpenNextConfig } from '@opennextjs/aws/types/open-next.js'; |
| 40 | +import type { OpenNextConfig } from '@opennextjs/aws/types/open-next'; |
41 | 41 |
|
42 | 42 | const config = { |
43 | 43 | default: {}, |
@@ -122,7 +122,7 @@ now, when you run `nx open-next-build next-site`, nx will automatically build th |
122 | 122 |
|
123 | 123 | Now, we have a built app, ready to deploy, so how do we get it onto SST/AWS ? Good question! |
124 | 124 |
|
125 | | -We are using `sst ion` in this example. i will assume you have already have the cli installed, (if not, check here on how!)[https://ion.sst.dev/], |
| 125 | +We are using `sst ion` in this example. i will assume you have already have the cli installed, [if not, check here on how](https://sst.dev), |
126 | 126 | but we will not use the SST cli to init this project, because it wants to add a package.json to your next app, and it will look like it's working, but you will end up with a big far server error (all because the package.json overrides whatever nx _thinks_ there should be, and it will miss a bunch of dependencies). we will instead manually set this up: |
127 | 127 |
|
128 | 128 | - let's add the sst package with `pnpm add sst@ion`, and the required packages for SST to work with AWS `pnpm add --save-dev aws-cdk-lib constructs @types/aws-lambda` |
|
0 commit comments