#How to stop `next build` bundling an absolute path referenced in source code

5 messages · Page 1 of 1 (latest)

indigo gorge
#

We're creating a standalone build of a Next.js app, but the .next/standalone directory contains a directory that we don't want to be included.

The reason it seems to be included is that one of our files contains an absolute path to the directory (like {path.resolve()}/blah). If we remove those paths from our source, they no longer get bundled into the standalone directory.

I assume Webpack is seeing this absolute path and assuming it must be included in the bundle. Is there a recommended way to tell Webpack to ignore this path?

Note, we're not requireing or importing the path, so I'm not sure why Webpack thinks it needs to be included in the bundle in the first palce.

sour oracleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

indigo gorge
#

interesting, thank you - will just give it a try!

indigo gorge
#

perfect, thanks! we're on Next.js 14 so had to put it inside experimental: { ... } but that worked