@@ -97,7 +97,29 @@ module.exports = (env, argv) => {
9797 '**/pdf_viewer.html' ,
9898 ]
9999 } ;
100- const pluginsForLastModule = [ ] ;
100+ const module1Plugins = [
101+ new CopyWebpackPlugin ( {
102+ patterns : [
103+ { from : 'src/pages' , to : 'pages' , globOptions : pagesCopyOptions } ,
104+ { from : 'src/content_scripts/ui/frontend.html' , to : 'pages' } ,
105+ { from : 'src/content_scripts/ui/frontend.css' , to : 'pages' } ,
106+ { from : 'node_modules/ace-builds/src-noconflict/worker-javascript.js' , to : 'pages' } ,
107+ { from : 'node_modules/pdfjs-dist/cmaps' , to : 'pages/cmaps' } ,
108+ { from : 'node_modules/pdfjs-dist/build/pdf.min.mjs' , to : 'pages' } ,
109+ { from : 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs' , to : 'pages' } ,
110+ { from : 'src/icons' , to : 'icons' } ,
111+ { from : 'src/content_scripts/content.css' , to : 'content.css' } ,
112+ {
113+ from : "src/manifest.json" ,
114+ to : "." ,
115+ transform ( content , path ) {
116+ return modifyManifest ( browser , mode , content )
117+ }
118+ }
119+ ]
120+ } )
121+ ] ;
122+ const module2Plugins = [ ] ;
101123 if ( browser === "chrome" ) {
102124 pagesCopyOptions . ignore = [ ] ;
103125 entry [ 'pages/neovim' ] = './src/pages/neovim.js' ;
@@ -107,20 +129,20 @@ module.exports = (env, argv) => {
107129 if ( browser !== "safari" ) {
108130 entry [ 'pages/markdown' ] = './src/content_scripts/markdown.js' ;
109131 if ( mode === "production" ) {
110- pluginsForLastModule . push (
111- new FileManagerPlugin ( {
112- events : {
113- onEnd : {
114- archive : [
115- {
116- source : buildPath ,
117- destination : `${ buildPath } /sk.zip`
118- } ,
119- ] ,
120- } ,
132+ const zipPlugin = new FileManagerPlugin ( {
133+ events : {
134+ onEnd : {
135+ archive : [
136+ {
137+ source : buildPath ,
138+ destination : `${ buildPath } /sk.zip`
139+ } ,
140+ ] ,
121141 } ,
122- } )
123- ) ;
142+ } ,
143+ } ) ;
144+ module1Plugins . push ( zipPlugin ) ;
145+ module2Plugins . push ( zipPlugin ) ;
124146 }
125147 } else {
126148 pagesCopyOptions . ignore . push ( '**/markdown.html' ) ;
@@ -172,28 +194,7 @@ module.exports = (env, argv) => {
172194 extractComments : false ,
173195 } ) ] ,
174196 } ,
175- plugins : [
176- new CopyWebpackPlugin ( {
177- patterns : [
178- { from : 'src/pages' , to : 'pages' , globOptions : pagesCopyOptions } ,
179- { from : 'src/content_scripts/ui/frontend.html' , to : 'pages' } ,
180- { from : 'src/content_scripts/ui/frontend.css' , to : 'pages' } ,
181- { from : 'node_modules/ace-builds/src-noconflict/worker-javascript.js' , to : 'pages' } ,
182- { from : 'node_modules/pdfjs-dist/cmaps' , to : 'pages/cmaps' } ,
183- { from : 'node_modules/pdfjs-dist/build/pdf.min.mjs' , to : 'pages' } ,
184- { from : 'node_modules/pdfjs-dist/build/pdf.worker.min.mjs' , to : 'pages' } ,
185- { from : 'src/icons' , to : 'icons' } ,
186- { from : 'src/content_scripts/content.css' , to : 'content.css' } ,
187- {
188- from : "src/manifest.json" ,
189- to : "." ,
190- transform ( content , path ) {
191- return modifyManifest ( browser , mode , content )
192- }
193- }
194- ]
195- } )
196- ]
197+ plugins : module1Plugins
197198 } , {
198199 devtool : false ,
199200 output : {
@@ -227,7 +228,7 @@ module.exports = (env, argv) => {
227228 extractComments : false ,
228229 } ) ] ,
229230 } ,
230- plugins : pluginsForLastModule ,
231+ plugins : module2Plugins ,
231232 experiments : {
232233 outputModule : true ,
233234 }
0 commit comments