Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/extension/src/lib/extensionScripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const registerBrowserContentScripts = async (): Promise<void> => {
// TODO: this needs to be switched to browser.scripting when bumping FF to V3 as well
await browser.contentScripts.register({
matches: ['*://*/*'],
css: [{ file: 'css/daily-companion-app.css' }],
css: [{ file: 'css/companion.css' }],
js: [
{ file: 'js/content.bundle.js' },
{ file: 'js/companion.bundle.js' },
Expand All @@ -50,7 +50,7 @@ export const registerBrowserContentScripts = async (): Promise<void> => {
{
id: companionScriptId,
matches: ['*://*/*'],
css: ['css/daily-companion-app.css'],
css: ['css/companion.css'],
js: ['js/content.bundle.js', 'js/companion.bundle.js'],
},
]);
Expand Down
14 changes: 10 additions & 4 deletions packages/extension/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,17 @@ const mainConfig = {
],
optimization: {
...baseConfig.optimization,
// Enable runtime chunk to reduce individual bundle sizes
runtimeChunk: 'single',
// Split chunks to reduce newtab bundle size and avoid "Invalid array length" errors
// Only extract runtime for newtab; content scripts must stay self-contained
runtimeChunk: {
name(entrypoint) {
return entrypoint.name === 'newtab' ? 'runtime' : false;
},
},
// Only split newtab chunks; content scripts must remain single bundles
splitChunks: {
chunks: 'all',
chunks(chunk) {
return !['content', 'companion', 'manifest'].includes(chunk.name);
},
maxSize: 244000, // ~238KB max chunk size to avoid V8 limits
cacheGroups: {
defaultVendors: {
Expand Down