11import react from "@vitejs/plugin-react-swc" ;
22import { config } from "dotenv" ;
3- import path , { resolve } from "path" ;
3+ import { resolve } from "path" ;
44import { defineConfig } from "vite" ;
55
66import checkLocalesForMissingKeys from "./src/utils/checkLocalesForMissingKeys" ;
@@ -37,37 +37,14 @@ export default function build() {
3737 popup : resolve ( pagesDir , "popup" , "index.html" )
3838 } ,
3939 output : {
40- assetFileNames : ( chunk ) => {
41- return `assets/${ chunk . name } ` ;
42- } ,
43- chunkFileNames : ( chunk ) => {
44- return `assets/${ chunk . name } .js` ;
45- } ,
46- entryFileNames : ( chunk ) => {
47- return `src/pages/${ chunk . name } /index.js` ;
48- } ,
40+ assetFileNames : ( chunk ) => `src/${ chunk . name } ` ,
41+ chunkFileNames : ( chunk ) => `src/${ chunk . name } .js` ,
42+ entryFileNames : ( chunk ) => `src/pages/${ chunk . name } /index.js` ,
4943 manualChunks : ( id ) => {
50- if ( id . includes ( "node_modules/monaco-editor" ) ) {
51- const parts = id . split ( path . posix . sep || path . sep ) ;
52- const vsIndex = parts . findIndex ( ( part ) => part === "vs" ) ;
53- if ( vsIndex >= 0 && parts . length > vsIndex + 1 ) {
54- const { [ vsIndex + 2 ] : folder } = parts ;
55- switch ( folder ) {
56- case "browser" :
57- return "monaco-editor-browser" ;
58- case "common" :
59- return "monaco-editor-common" ;
60- case "contrib" :
61- return "monaco-editor-contrib" ;
62- case "standalone" :
63- return "monaco-editor-standalone" ;
64- default :
65- return "monaco-editor-other" ;
66- }
67- }
68- return "monaco-editor-other" ;
44+ if ( id . includes ( "node_modules" ) ) {
45+ const [ module ] = id . split ( "node_modules/" ) [ 1 ] . split ( "/" ) ;
46+ return `vendor/${ module . split ( "/" ) [ 0 ] } ` ;
6947 }
70- if ( id . includes ( "node_modules" ) ) return "vendor" ;
7148 }
7249 } ,
7350 treeshake : {
@@ -81,8 +58,8 @@ export default function build() {
8158 } ,
8259 esbuild : {
8360 keepNames : true ,
84- minifyIdentifiers : false ,
85- minifySyntax : false ,
61+ minifyIdentifiers : true ,
62+ minifySyntax : true ,
8663 minifyWhitespace : true
8764 } ,
8865 plugins : [ replaceDevModeConst ( ) , bundleWorker ( ) , react ( ) , makeManifest ( ) , buildContentScript ( ) , copyPublic ( ) , copyBuild ( ) , makeReleaseZips ( ) ] ,
0 commit comments