-
Notifications
You must be signed in to change notification settings - Fork 56
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
Doesn't recognize next.config.mjs #107
Comments
I had a similar problem to yours for a similar reason. - name: Build with Next.js
run: |
rm -f next.config.js
${{ steps.detect-package-manager.outputs.runner }} next build |
is a solution found to this issue? |
@OtmaniCodes I ended up commenting out this line from the build step to make it work: You can check my workflow file for reference. |
Thank you |
The available workaround is to provide the path in your Actions workflow via the - name: Setup Pages
uses: actions/configure-pages@v4
with:
static_site_generator: next
generator_config_file: ./next.config.mjs For now, I'll leave this issue open to look at auto-detecting alternative file paths. It's not something we'd prioritize highly, but it isn't an unreasonable expectation given the behind-the-scenes magic this action is already attempting to take care of on users' behalf. 🤷 |
A fix for this is now included in e.g. - name: Setup Pages
uses: actions/configure-pages@v5
with:
static_site_generator: next |
I'm still getting the error after tyring all the above solutions. I'm new to JavaScript world. Can some one help me identify the problem. Below is the github action error. But I'm able to build the page locally without any errors. '''Run actions/configure-pages@v5 /** @type {import('next').NextConfig} */
}; export default withMDX(nextConfig); Error: TypeError: error must be an instance of Error''' |
@JamesMGreene The fix works well when there's no import, but seems to break when importing a dependency (or at least the // @ts-check
import NextBundleAnalyzer from '@next/bundle-analyzer';
const withBundleAnalyzer = NextBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
});
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "export"
};
export default withBundleAnalyzer(nextConfig); results in the Commenting the A minor inconvenience, but a workaround suffices. Glad to see the project continued adoption! |
- Solution to build issue was found here: actions/configure-pages#107 (comment)
Can echo @richardtorres314 on breaking when there's an import. Mine fails when I use an import as such: import nextMDX from "@next/mdx";
const withMDX = nextMDX();
/** @type {import('next').NextConfig} */
const nextConfig = {
// Configure `pageExtensions` to include MDX files
pageExtensions: ["js", "jsx", "mdx", "ts", "tsx"]
};
export default withMDX(nextConfig); |
@ashrielbrian have you resolved the issue? |
@staceysych23 yeah, i uncommented all the options for the GH action. This suffices:
|
It works fine with the
js
extension:...but when I have a
next.config.mjs
, it ignores it and makes up a new config file on its own:The text was updated successfully, but these errors were encountered: