Force include dependencies for 'standalone' output #66327
Unanswered
Ondreej
asked this question in
App Router
Replies: 1 comment
-
I encountered the same problem when trying to use In next.config.js: const { nodeFileTrace } = require('@vercel/nft');
const nextConfig = async () => {
// resolve files that are needed for additional packages to work
const { fileList: additionalTracedFiles } = await nodeFileTrace(
// add entry points for the missing packages or any additional scripts you need here
[require.resolve('@dotenvx/dotenvx/src/cli/dotenvx')],
{
// ignore unnecesary files if nft includes too many (in my case: it included absolutely everything in node_modules/.bin)
ignore: (file) => {
return file.replace(/\\/g, '/').startsWith('node_modules/.bin/');
},
}
);
/** @type {import('next').NextConfig} */
return {
/*...*/
experimental: {
outputFileTracingIncludes: {
'**': [
// everything that additional packages depends on
...additionalTracedFiles,
// add only binaries for additional packages if ignored earlier
'./node_modules/.bin/dotenvx*',
],
},
},
};
};
module.exports = nextConfig; This config was created to work with nextjs v14. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working with Next 15 RC and have configured my next.config.js for a standalone output.
But after building the website, I need to run certain commands that require packages not included by default in the standalone build, such as
cross-env
. (for example, I need to run Payload v3 migrations inside a docker container)Is there a way to explicitly include specific dependencies in the standalone build output?
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions