Damon
Damon
NNuxt
Created by Damon on 5/20/2024 in #❓・help
Upgrading nuxt/sentry from 6.x to 8.x causes syntax error on export
I have a Nuxt 2.17 project I've inherited and am working to upgrade the nuxt/sentry module to 8.x from 6.x. The upgrade went smoothly until I loaded my browser and I get an error in the console:
Uncaught SyntaxError: The requested module 'http://localhost:4000/node_modules/lodash.mergewith/index.js' doesn't provide an export named: 'default'
Uncaught SyntaxError: The requested module 'http://localhost:4000/node_modules/lodash.mergewith/index.js' doesn't provide an export named: 'default'
This problem seems to stem from the .nuxt/sentry.client.shared.js file which appears (to me) to be auto-generated during the build (new to Nuxt! sorry!).
In the console, I can inspect the file and see the import statement that is causing the error:
import merge from '/node_modules/lodash.mergewith/index.js'
import merge from '/node_modules/lodash.mergewith/index.js'
When I look at node_modules/lodash.mergewith/index.js I see it is using module.exports instead of export default so it seems this would mean we would need to require('lodash.mergewith').
But why doesn't nuxt know to do that already? How do I tell it to? I've been googling and chat-gpt-ing and not finding any straightforward answer. Humans! I miss humans!
1 replies