Hi,
I’m trying to build my next js app that uses cesium package.
I can run the dev build, but when next build executes (so I can ship it) - it fails to copy over files from ‘node_modules/cesium/Build/Cesium/Workers’ due to “‘import’, and ‘export’ cannot be used outside of module code” (done by CopyWebpackPlugin in next.config.js).
Can you advise how nextjs (and webpack) should be configured to allow cesium to be used?
new CopyWebpackPlugin({
patterns: [
{
from: path.join(
__dirname,
‘node_modules/cesium/Build/Cesium/Workers’
),
to: ‘…/public/Cesium/Workers’,
},
{
from: path.join(
__dirname,
‘node_modules/cesium/Source/ThirdParty’
),
to: ‘…/public/Cesium/ThirdParty’,
},
{
from: path.join(
__dirname,
‘node_modules/cesium/Source/Assets’
),
to: ‘…/public/Cesium/Assets’,
},
{
from: path.join(
__dirname,
‘node_modules/cesium/Source/Widgets’
),
to: ‘…/public/Cesium/Widgets’,
},
],
})