DataCloneError Next 15
Unanswered
Beveren posted this in #help-forum
BeverenOP
const nextConfig = {
images: {
domains: ['some domain'],
unoptimized: true
},
experimental: {
workerThreads: true,
cpus: 4
},
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ['@svgr/webpack']
})
return config
}
}
const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
})
module.exports = process.env.ANALYZE === 'true' ? withBundleAnalyzer(nextConfig) : nextConfig
when migrated to nextb 15 from next 14 got DataCloneError . In this if I chnage workerThreads:false it will run fine. But I''m not sure why the dataclone error is occuring in the first placeespecially if in the previous versions it was working fine
21 Replies
Chub mackerel
The DataCloneError in Next.js 15 with workerThreads can be fixed by disabling workerThreads.
@Chub mackerel The DataCloneError in Next.js 15 with workerThreads can be fixed by disabling workerThreads.
BeverenOP
Yeah I know but is there another way to solve this problem?
Chub mackerel
Idk☹
@Chub mackerel Idk☹
BeverenOP
cause like what if you want worker threads to be enabled right but I can't find any other solution
@Chub mackerel Idk☹
BeverenOP
like it worked fine in next 14 but as soon as you convert to next 15 that's when the datacloneerror shows
Chub mackerel
Just make sure all the data you send between worker threads is serializable! This way, you'll avoid any pesky DataCloneErrors
@Chub mackerel Just make sure all the data you send between worker threads is serializable! This way, you'll avoid any pesky DataCloneErrors
BeverenOP
so when I comment out module.exports it also solves the issue
@Chub mackerel Just make sure all the data you send between worker threads is serializable! This way, you'll avoid any pesky DataCloneErrors
BeverenOP
but like how would I amke this data serelizable
as you can see above
like I don't know how to
webpack(config) {
config.module.rules.push({
test: /.svg$/,
use: ['@svgr/webpack']
})
return config
} const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
}) like I don't know how to make them serelizable
config.module.rules.push({
test: /.svg$/,
use: ['@svgr/webpack']
})
return config
} const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
}) like I don't know how to make them serelizable
could you please help on how to do it
BeverenOP
@Chub mackerel so do you have any idea or not?
Chub mackerel
Makes sense, prob the webpack fn or bundle-analyzer wrapper isn’t serializable in Next 15 workerThreads
@Chub mackerel Makes sense, prob the webpack fn or bundle-analyzer wrapper isn’t serializable in Next 15 workerThreads
BeverenOP
but do you know how to make it serelizable?
@Chub mackerel I found this
https://medium.com/@specktackle/next-js-13-and-the-curious-case-of-non-serializable-props-42cabec4ab6c
BeverenOP
but I don't even know how to even convert those functions into serelizable
Chub mackerel
Yeah same here
ask gpt
it would help
@Chub mackerel Yeah same here
BeverenOP
it gives wrong answers though I've already tried that