Next.js Discord

Discord Forum

NextJS not viable for Chrome extension development?

Unanswered
Dwarf Hotot posted this in #help-forum
Open in Discord
Dwarf HototOP
I'm unable to find any documentation that will help me unblock this process. Specfically, NextJS doesn't seem to have any options for affecting the behavior of how JS is chunked during the build process. It's an unnecessary optimization in the context of a web extension and to make matters worse, these chunks (and other assets) are loaded from a _next folder. Since Chrome reserves filenames that start with _ for use by the system, Chrome won't load extensions that use them to store assets.

I've found a few bugs filed around this issue and some suggestions to pass config options to webpack 5 leading me to attempt the following in next.config.mjs

const nextConfig = {
//...,
  webpack: (config, foo) => {
    config.output.publicPath = '/site/next'
    return config;
  },
};
export default nextConfig;


But maybe I'm doing it wrong? I was able to use sed to rename occurences but that doesn't feel as 'safe' and I'd really prefer to have it as a part of the actual build output. It also doesn't address the chunking issue which I'd really to minimize if possible. I'm worried that Google's over-zealous scanners will send up false positives all over my extension if I try to publish it in this state.

Lastly, why are there .txt files generated for every .html file?

0 Replies