Skip to content

Commit

Permalink
NoJira: NextJS Runtime Plugin 5.2 Compatibility (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
sherakama authored May 14, 2024
1 parent 6ddb8f7 commit 74f9c66
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,17 @@
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^5.1.0",
"eslint-plugin-prettier": "^5.0.0"
},
"peerDependencies": {
"@netlify/plugin-nextjs": ">=5.2",
"next": ">=13.5.6"
},
"peerDependenciesMeta": {
"@netlify/plugin-nextjs": {
"optional": true
},
"next": {
"optional": true
}
}
}
16 changes: 1 addition & 15 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,6 @@ module.exports = {
netlifyConfig.functions['*'].external_node_modules = [];
}
netlifyConfig.functions['*'].external_node_modules.push('dotenv');

// Ensure that the .env file we are writing gets bundled with the func.
if (!Array.isArray(netlifyConfig.functions['*'].included_files)) {
netlifyConfig.functions['*'].included_files = [];
}
netlifyConfig.functions['*'].included_files.push('.env');
}

// Contextualize the secrets.
Expand Down Expand Up @@ -118,15 +112,7 @@ module.exports = {

// Display success information
status.show({
summary: `Added environment variables from vault to environment and LAMBDA`,
summary: `Added ${secretsToWrite.length} environment variables from vault to this build.`,
});
},
// Remove env file if on Netilfy.
async onPostBuild() {
const isNetlify = process.env.NETLIFY || false;
const envFilePath = path.resolve(process.cwd(), '.env');
if (isNetlify) {
fs.unlinkSync(envFilePath);
}
},
};

0 comments on commit 74f9c66

Please sign in to comment.