@netlify/plugin-nextjs 4.2.8 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -48,7 +48,7 @@ const configureHandlerFunctions = ({ netlifyConfig, publish, ignore = [] }) => {
48
48
  netlifyConfig.functions[functionName].included_files.push('.env', '.env.local', '.env.production', '.env.production.local', `${publish}/server/**`, `${publish}/serverless/**`, `${publish}/*.json`, `${publish}/BUILD_ID`, `${publish}/static/chunks/webpack-middleware*.js`, `!${publish}/server/**/*.js.nft.json`, ...ignore.map((path) => `!${(0, slash_1.default)(path)}`));
49
49
  const nextRoot = resolveModuleRoot('next');
50
50
  if (nextRoot) {
51
- netlifyConfig.functions[functionName].included_files.push(`!${nextRoot}/dist/server/lib/squoosh/**/*.wasm`, `!${nextRoot}/dist/next-server/server/lib/squoosh/**/*.wasm`, `!${nextRoot}/dist/compiled/webpack/bundle4.js`, `!${nextRoot}/dist/compiled/webpack/bundle5.js`, `!${nextRoot}/dist/compiled/terser/bundle.min.js`);
51
+ netlifyConfig.functions[functionName].included_files.push(`!${nextRoot}/dist/server/lib/squoosh/**/*.wasm`, `!${nextRoot}/dist/next-server/server/lib/squoosh/**/*.wasm`, `!${nextRoot}/dist/compiled/webpack/bundle4.js`, `!${nextRoot}/dist/compiled/webpack/bundle5.js`);
52
52
  }
53
53
  DEFAULT_EXCLUDED_MODULES.forEach((moduleName) => {
54
54
  const moduleRoot = resolveModuleRoot(moduleName);
@@ -54,6 +54,9 @@ const matchesRewrite = (file, rewrites) => {
54
54
  exports.matchesRewrite = matchesRewrite;
55
55
  const getMiddleware = async (publish) => {
56
56
  var _a;
57
+ if (process.env.NEXT_SKIP_MIDDLEWARE) {
58
+ return [];
59
+ }
57
60
  const manifestPath = (0, pathe_1.join)(publish, 'server', 'middleware-manifest.json');
58
61
  if ((0, fs_extra_1.existsSync)(manifestPath)) {
59
62
  const manifest = await (0, fs_extra_1.readJson)(manifestPath, { throws: false });
@@ -14,9 +14,12 @@ const { augmentFsModule, getMaxAge, getMultiValueHeaders, getNextServer } = requ
14
14
  // eslint-disable-next-line max-params
15
15
  const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') => {
16
16
  var _a;
17
- // Change working directory into the site root
17
+ // Change working directory into the site root, unless using Nx, which moves the
18
+ // dist directory and handles this itself
18
19
  const dir = path.resolve(__dirname, app);
19
- process.chdir(dir);
20
+ if (pageRoot.startsWith(dir)) {
21
+ process.chdir(dir);
22
+ }
20
23
  // This is just so nft knows about the page entrypoints. It's not actually used
21
24
  try {
22
25
  // eslint-disable-next-line node/no-missing-require
@@ -30,6 +33,9 @@ const makeHandler = (conf, app, pageRoot, staticManifest = [], mode = 'ssr') =>
30
33
  // This is our flag that we use when patching the source
31
34
  // eslint-disable-next-line no-underscore-dangle
32
35
  process.env._BYPASS_SSG = 'true';
36
+ for (const [key, value] of Object.entries(conf.env)) {
37
+ process.env[key] = String(value);
38
+ }
33
39
  // Set during the request as it needs the host header. Hoisted so we can define the function once
34
40
  let base;
35
41
  augmentFsModule({ promises, staticManifest, pageRoot, getBase: () => base });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "4.2.8",
3
+ "version": "4.3.2",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "lib/index.js",
6
6
  "files": [
@@ -60,7 +60,7 @@
60
60
  "fs-extra": "^10.0.0",
61
61
  "globby": "^11.0.4",
62
62
  "moize": "^6.1.0",
63
- "next": "^12.0.10",
63
+ "next": "^12.1.4",
64
64
  "node-fetch": "^2.6.6",
65
65
  "node-stream-zip": "^1.15.0",
66
66
  "outdent": "^0.8.0",
@@ -75,8 +75,8 @@
75
75
  "@babel/core": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-typescript": "^7.16.0",
78
- "@netlify/build": "^26.5.0",
79
- "@netlify/eslint-config-node": "^5.1.6",
78
+ "@netlify/build": "^26.5.2",
79
+ "@netlify/eslint-config-node": "^5.1.8",
80
80
  "@reach/dialog": "^0.16.2",
81
81
  "@reach/visually-hidden": "^0.16.0",
82
82
  "@testing-library/cypress": "^8.0.1",