diff --git a/package-lock.json b/package-lock.json index 3df8dba6c..5f4c293b4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,7 +58,7 @@ "scratch-l10n": "3.18.53", "scratch-render-fonts": "1.0.20", "scratch-semantic-release-config": "1.0.14", - "scratch-webpack-configuration": "1.0.0", + "scratch-webpack-configuration": "1.1.0", "script-loader": "0.7.2", "semantic-release": "19.0.5", "stats.js": "0.17.0", @@ -18704,9 +18704,9 @@ "integrity": "sha512-lC0ohKbx1g+q5fvYUmG0sFxEdlWL7BUcUxkah5UzUAFE5eqhW+JS7U9bFm4HbwqSovuuI1Xpl4qyu/9yJtrW5w==" }, "node_modules/scratch-webpack-configuration": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/scratch-webpack-configuration/-/scratch-webpack-configuration-1.0.0.tgz", - "integrity": "sha512-8t3Lda+kOPR/C+0jR1eOmyLO4pjDjT0BAWtmrZ1sXYfCmDhZreOwZMD6127aFYZbCWGK3qn0j2fjSi+unBnG4g==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/scratch-webpack-configuration/-/scratch-webpack-configuration-1.1.0.tgz", + "integrity": "sha512-YjdOWGphdgOa/0HA3D6f2+WVLd0rj5UuwqowyLMZsXDGeoqlOHz2RVObWCkZ+/HBcQxsyy7gMjPX3dV6Mj+rbQ==", "dev": true, "dependencies": { "lodash.merge": "^4.6.2", diff --git a/package.json b/package.json index bfd22a172..6bd9e30a1 100644 --- a/package.json +++ b/package.json @@ -96,7 +96,7 @@ "scratch-l10n": "3.18.53", "scratch-render-fonts": "1.0.20", "scratch-semantic-release-config": "1.0.14", - "scratch-webpack-configuration": "1.0.0", + "scratch-webpack-configuration": "1.1.0", "script-loader": "0.7.2", "semantic-release": "19.0.5", "stats.js": "0.17.0", diff --git a/webpack.config.js b/webpack.config.js index fb7122d09..03e029637 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,15 +10,14 @@ const common = { rootPath: path.resolve(__dirname) }; -const nodeConfig = new ScratchWebpackConfigBuilder(common) +const nodeBuilder = new ScratchWebpackConfigBuilder(common) .setTarget('node') .addModuleRule({ test: /\.mp3$/, type: 'asset' - }) - .get(); + }); -const webConfig = new ScratchWebpackConfigBuilder(common) +const webBuilder = new ScratchWebpackConfigBuilder(common) .setTarget('browserslist') .merge({ resolve: { @@ -40,11 +39,9 @@ const webConfig = new ScratchWebpackConfigBuilder(common) }) .addPlugin(new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'] - })) - .get(); + })); -const playgroundConfig = new ScratchWebpackConfigBuilder(common) - .setTarget('browserslist') +const playgroundBuilder = webBuilder.clone() .merge({ devServer: { contentBase: false, @@ -60,23 +57,11 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common) }, output: { path: path.resolve(__dirname, 'playground') - }, - resolve: { - fallback: { - Buffer: require.resolve('buffer/') - } } }) .addModuleRule({ - test: /\.mp3$/, - type: 'asset' - }) - .addModuleRule({ - test: require.resolve('./src/index.js'), - loader: 'expose-loader', - options: { - exposes: 'VirtualMachine' - } + test: require.resolve('stats.js/build/stats.min.js'), + loader: 'script-loader' }) .addModuleRule({ test: require.resolve('./src/extensions/scratch3_video_sensing/debug.js'), @@ -85,10 +70,6 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common) exposes: 'Scratch3VideoSensingDebug' } }) - .addModuleRule({ - test: require.resolve('stats.js/build/stats.min.js'), - loader: 'script-loader' - }) .addModuleRule({ test: require.resolve('scratch-blocks/dist/vertical.js'), loader: 'expose-loader', @@ -117,9 +98,6 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common) exposes: 'ScratchRender' } }) - .addPlugin(new webpack.ProvidePlugin({ - Buffer: ['buffer', 'Buffer'] - })) .addPlugin(new CopyWebpackPlugin([ { from: 'node_modules/scratch-blocks/media', @@ -137,11 +115,10 @@ const playgroundConfig = new ScratchWebpackConfigBuilder(common) { from: 'src/playground' } - ])) - .get(); + ])); module.exports = [ - nodeConfig, - webConfig, - playgroundConfig + nodeBuilder.get(), + webBuilder.get(), + playgroundBuilder.get() ];