-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
working-directory
input assumes a .next
folder
#48
Comments
Yeah that's fair. I'm not completely opposed to the breaking change but I'd want to consider other options before that. Do you think it's possible for this action to read your next.config.js in import next from 'next';
const nextApp = next({});
const distDir = nextApp.options.conf?.distDir; |
Yeah, I believe that option could work — however my concern would be that the only way I'm aware of to get the actual loaded/parsed config is to use a private method in the
It feels like it could be somewhat fragile and prone to break unexpectedly with Next.js updates so it may not be ideal to rely on. |
I tested it out and yeah that seems to be the case, the example I gave doesn't actually work as I expected. But I also noticed that the next storybook plugin has to deal with the same problem and they import So if I write something like this, it seems to point to the actual import { PHASE_PRODUCTION_BUILD } from "next/constants.js";
import loadConfig from "next/dist/server/config.js";
const nextConfig = await loadConfig.default(
PHASE_PRODUCTION_BUILD,
process.cwd(),
);
console.log(nextConfig.distDir); I'm a little bit more confident about this approach since these methods aren't marked private, but I do wonder if bundling Next.js into the action increases the size of the action dramatically. Another alternative is that we expose a Let me know what you think. |
Ah, interesting! I wasn't aware of that approach to using Exposing an additional |
Yep, that makes sense to me. Perhaps |
Is this a change you'd be will to make? Or would you prefer I take a stab at it? |
I don't think I'll have time to work on this any time soon but I'd be willing to review any PRs. |
This looks like a great action that I'd like to use, but it isn't compatible with how we configure Next.js's
distDir
. More specifically, we have a variety of tools in our repository that use a common.build
directory for outputting any build-related artifacts. So, for example, Next.js uses.build/next
. While we could certainly update the variety of places (ignore files, cleanup scripts, etc.) we assume.build/next
, it would be nice if there was a way for this action to accept a working directory that maps more directly to howdistDir
behaves instead of assuming a.next
folder must exist.I do recognize that changing the behavior of the
working-directory
input in this manner would be a breaking change, but I'm wondering if this sort of functionality is something you'd be amenable to adopting (either as a future version or via some other combinations of inputs that preserves the current functionality)? Thanks!The text was updated successfully, but these errors were encountered: