I'm trying to export our site using Next. Prior to working with next we had a custom webpack build that would specify an output format so we can append a hash.
output: {
filename: 'file-main.[chunkhash].js'
},
I adjusted the next.config.js to have a customized webpack configuration like so:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
experimental: {
images: {
unoptimized: true,
},
},
webpack: (
config,
{ buildId, dev, isServer, defaultLoaders, nextRuntime, webpack }
) => {
const newConfig = {
...config,
output: {
filename: '[main].[contenthash].js',
},
};
return newConfig;
},
};
module.exports = nextConfig;
When I try and next export I get this error
Build error occurred [Error: ENOENT: no such file or directory, open 'C:\repos\storefront-admin\storefront-ui.next\server\pages-manifest.json'] { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'C:\repos\storefront-admin\storefront-ui\.next\server\pages-manifest.json' } info - Collecting page data .
Has anyone changed the output filenames successfully?