-
Notifications
You must be signed in to change notification settings - Fork 276
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
Can't import constants in next.config.mjs/js #1980
Comments
Just to add: it's not that This is a disconcerting thought, and that's why this merits some thorough testing, now and in the future. |
After going through the migration and no errors remaining, a build now produces this:
So it's going wrong at "Collecting page data". I have no bloody clue where I'm supposed to go looking to fix it. It doesn't say where this include is actually coming, and it is incorrectly telling me to replace a Please provide a fix at your earliest convenience. This is now blocking us. Critical priority please. |
If I go to It appears to work. Or at least the build doesn't explode. But again, this is a horrible and unsustainable workaround that will only work on my machine, and will be replaced at the whim of an npm install, or indeed a deployment to any environment beyond my local dev. The real solution is to not transpile to arcane |
Thanks for bringing this to light @thany . I must not that breaking changes are possible between minor versions (as outlined in changelog https://github.com/Sitecore/jss/blob/dev/CHANGELOG.md) , but this looks more like an unintended regression. It's not very clear why it happens - chalk has been present and componen-props-service hasn't been changed for a long time. |
Doing some more investigation, I see JSS uses |
What version of Next.js are you using that doesn't support this? We are on 14, switching to 15 shortly. |
Describe the Bug
When I import constants like this in my next.config.mjs:
The build will break:
But when I change the import to:
It works fine.
It makes no difference if it's called
next.config.js
ornext.config.mjs
.This is in an update from 22.0.0 to 22.2.1, and there was nothing in the changelog about this, even though it's clearly a breaking change.
To Reproduce
Use the import as described.
Expected Behavior
It should not complain about import bollocks. Those are among the most frustrating errors you could possibly run into.
Possible Fix
No response
Provide environment information
The text was updated successfully, but these errors were encountered: