* Enforce specific package.json configuration for smallest possible lambda
(
defaultPackageJson: {
dependencies?: stringMap;
devDependencies?: stringMap;
scripts?: stringMap;
} = {}
)
| 153 | * Enforce specific package.json configuration for smallest possible lambda |
| 154 | */ |
| 155 | function normalizePackageJson( |
| 156 | defaultPackageJson: { |
| 157 | dependencies?: stringMap; |
| 158 | devDependencies?: stringMap; |
| 159 | scripts?: stringMap; |
| 160 | } = {} |
| 161 | ) { |
| 162 | const dependencies: stringMap = {}; |
| 163 | const devDependencies: stringMap = { |
| 164 | ...defaultPackageJson.dependencies, |
| 165 | ...defaultPackageJson.devDependencies, |
| 166 | }; |
| 167 | |
| 168 | if (devDependencies.react) { |
| 169 | dependencies.react = devDependencies.react; |
| 170 | delete devDependencies.react; |
| 171 | } |
| 172 | |
| 173 | if (devDependencies['react-dom']) { |
| 174 | dependencies['react-dom'] = devDependencies['react-dom']; |
| 175 | delete devDependencies['react-dom']; |
| 176 | } |
| 177 | |
| 178 | delete devDependencies['next-server']; |
| 179 | |
| 180 | return { |
| 181 | ...defaultPackageJson, |
| 182 | dependencies: { |
| 183 | // react and react-dom can be overwritten |
| 184 | react: 'latest', |
| 185 | 'react-dom': 'latest', |
| 186 | ...dependencies, // override react if user provided it |
| 187 | // next-server is forced to canary |
| 188 | 'next-server': 'v7.0.2-canary.49', |
| 189 | }, |
| 190 | devDependencies: { |
| 191 | ...devDependencies, |
| 192 | // next is forced to canary |
| 193 | next: 'v7.0.2-canary.49', |
| 194 | }, |
| 195 | scripts: { |
| 196 | ...defaultPackageJson.scripts, |
| 197 | 'now-build': |
| 198 | 'NODE_OPTIONS=--max_old_space_size=3000 next build --lambdas', |
| 199 | }, |
| 200 | }; |
| 201 | } |
| 202 | |
| 203 | async function getNextConfig(workPath: string, entryPath: string) { |
| 204 | const entryConfig = path.join(entryPath, './next.config.js'); |
no outgoing calls
no test coverage detected