production build issue with `date-fns`
See original GitHub issueEnvironment
- Operating System:
Darwin
- Node Version:
v16.14.0
- Nuxt Version:
3.0.0-rc.6-27668034.5232c1b
- Package Manager:
npm@8.3.1
- Builder:
vite
- User Config:
buildModules
,modules
,intlify
,css
,colorMode
,build
,publicRuntimeConfig
,meta
- Runtime Modules:
@nuxtjs/color-mode@3.1.4
- Build Modules:
@intlify/nuxt3@0.2.3
,@pinia/nuxt@0.3.1
Reproduction
https://www.evgyuru.hu/ https://answers.netlify.com/t/this-function-has-crashed-but-i-have-no-netlify-functions/72053/9?u=gyurmatag This repo is not working when deployed to Netlify https://bitbucket.org/gyurmaland/nuxt-app/src/
Describe the bug
I have a Nuxt site deployed to Netlify but for over 2 weeks the site can’t be reached because it says the following:
Here is my site live, so you can see it in action: https://www.evgyuru.hu/ Also somebody from Netlify said that is a bug in Nuxt: https://answers.netlify.com/t/this-function-has-crashed-but-i-have-no-netlify-functions/72053/9?u=gyurmatag I provided the complete logs for this error.
Additional context
No response
Logs
Aug 10, 09:11:29 PM: 93e58501 ERROR [h3] [unhandled] H3Error: Directory import '/var/task/node_modules/date-fns/fp' is not supported resolving ES modules imported from /var/task/chunks/app/server.mjs
Did you mean to import date-fns/fp/index.js?
at createError (file:///var/task/node_modules/h3/dist/index.mjs:238:15)
at nodeHandler (file:///var/task/node_modules/h3/dist/index.mjs:428:21)
at async ufetch (file:///var/task/node_modules/unenv/runtime/fetch/index.mjs:9:17)
at async $fetchRaw2 (file:///var/task/node_modules/ohmyfetch/dist/chunks/fetch.mjs:131:20)
at async Object.errorhandler [as onError] (file:///var/task/chunks/nitro/aws-lambda.mjs:319:16)
at async nodeHandler (file:///var/task/node_modules/h3/dist/index.mjs:436:9)
at async ufetch (file:///var/task/node_modules/unenv/runtime/fetch/index.mjs:9:17)
at async $fetchRaw2 (file:///var/task/node_modules/ohmyfetch/dist/chunks/fetch.mjs:131:20)
at async Object.errorhandler [as onError] (file:///var/task/chunks/nitro/aws-lambda.mjs:319:16)
at async nodeHandler (file:///var/task/node_modules/h3/dist/index.mjs:436:9) {
statusCode: 500,
fatal: false,
unhandled: true,
statusMessage: 'Internal Server Error'
}
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:24 (8 by maintainers)
Top Results From Across the Web
date-fns the reason npm build fails on Next.js? - Stack Overflow
1. The issue isn't date-fns , it's the event variable that's undefined. Where is event coming from? Could you provide the code for...
Read more >date-fns - npm Package Health Analysis - Snyk
We found that date-fns demonstrates a positive version release cadence with at least one new version released in the past 12 months.
Read more >date-fns
27 is out and along with many fixes and improvements, it brings an important breaking change. From now on functions will accept only...
Read more >date-fns | Yarn - Package Manager
date -fns provides the most comprehensive, yet simple and consistent toolset for manipulating JavaScript dates in a browser & Node.js.
Read more >date-fns-tz - npm
Even when using ESM some CommonJS imports from date-fns will be used until they support ESM natively as well date-fns#1781. This is because...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have the same problem with rc7 and rc8 (also edge). I saw this error in the Netlify logs of my function:
@Mokkapps I fixed it by adding conditional logic transpile based on env