@@ -10,15 +10,14 @@ const common = {
1010 rootPath : path . resolve ( __dirname )
1111} ;
1212
13- const nodeConfig = new ScratchWebpackConfigBuilder ( common )
13+ const nodeBuilder = new ScratchWebpackConfigBuilder ( common )
1414 . setTarget ( 'node' )
1515 . addModuleRule ( {
1616 test : / \. m p 3 $ / ,
1717 type : 'asset'
18- } )
19- . get ( ) ;
18+ } ) ;
2019
21- const webConfig = new ScratchWebpackConfigBuilder ( common )
20+ const webBuilder = new ScratchWebpackConfigBuilder ( common )
2221 . setTarget ( 'browserslist' )
2322 . merge ( {
2423 resolve : {
@@ -40,11 +39,9 @@ const webConfig = new ScratchWebpackConfigBuilder(common)
4039 } )
4140 . addPlugin ( new webpack . ProvidePlugin ( {
4241 Buffer : [ 'buffer' , 'Buffer' ]
43- } ) )
44- . get ( ) ;
42+ } ) ) ;
4543
46- const playgroundConfig = new ScratchWebpackConfigBuilder ( common )
47- . setTarget ( 'browserslist' )
44+ const playgroundBuilder = webBuilder . clone ( )
4845 . merge ( {
4946 devServer : {
5047 contentBase : false ,
@@ -60,23 +57,11 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common)
6057 } ,
6158 output : {
6259 path : path . resolve ( __dirname , 'playground' )
63- } ,
64- resolve : {
65- fallback : {
66- Buffer : require . resolve ( 'buffer/' )
67- }
6860 }
6961 } )
7062 . addModuleRule ( {
71- test : / \. m p 3 $ / ,
72- type : 'asset'
73- } )
74- . addModuleRule ( {
75- test : require . resolve ( './src/index.js' ) ,
76- loader : 'expose-loader' ,
77- options : {
78- exposes : 'VirtualMachine'
79- }
63+ test : require . resolve ( 'stats.js/build/stats.min.js' ) ,
64+ loader : 'script-loader'
8065 } )
8166 . addModuleRule ( {
8267 test : require . resolve ( './src/extensions/scratch3_video_sensing/debug.js' ) ,
@@ -85,10 +70,6 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common)
8570 exposes : 'Scratch3VideoSensingDebug'
8671 }
8772 } )
88- . addModuleRule ( {
89- test : require . resolve ( 'stats.js/build/stats.min.js' ) ,
90- loader : 'script-loader'
91- } )
9273 . addModuleRule ( {
9374 test : require . resolve ( 'scratch-blocks/dist/vertical.js' ) ,
9475 loader : 'expose-loader' ,
@@ -117,9 +98,6 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common)
11798 exposes : 'ScratchRender'
11899 }
119100 } )
120- . addPlugin ( new webpack . ProvidePlugin ( {
121- Buffer : [ 'buffer' , 'Buffer' ]
122- } ) )
123101 . addPlugin ( new CopyWebpackPlugin ( [
124102 {
125103 from : 'node_modules/scratch-blocks/media' ,
@@ -137,11 +115,10 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common)
137115 {
138116 from : 'src/playground'
139117 }
140- ] ) )
141- . get ( ) ;
118+ ] ) ) ;
142119
143120module . exports = [
144- nodeConfig ,
145- webConfig ,
146- playgroundConfig
121+ nodeBuilder . get ( ) ,
122+ webBuilder . get ( ) ,
123+ playgroundBuilder . get ( )
147124] ;
0 commit comments