fix(build): misc webpack 5 build fixes

This commit is contained in:
Christopher Willis-Ford 2024-02-28 20:55:50 -08:00
parent 1ab9c11e19
commit 64d17098a1
2 changed files with 30 additions and 9 deletions

View file

@ -4,7 +4,7 @@ const log = require('../../util/log');
const formatMessage = require('format-message');
const MathUtil = require('../../util/math-util');
const BLE = require('../../io/ble');
const godirect = require('@vernier/godirect/dist/godirect.min.umd.js');
const godirect = require('@vernier/godirect');
const ScratchLinkDeviceAdapter = require('./scratch-link-device-adapter');
/**

View file

@ -15,7 +15,7 @@ const base = {
test: /\.js$/,
loader: 'babel-loader',
include: path.resolve(__dirname, 'src'),
query: {
options: {
presets: [['@babel/preset-env', {targets: {browsers: ['last 3 versions', 'Safari >= 8', 'iOS >= 8']}}]]
}
},
@ -50,7 +50,10 @@ module.exports = [
rules: base.module.rules.concat([
{
test: require.resolve('./src/index.js'),
loader: 'expose-loader?exposes=VirtualMachine'
loader: 'expose-loader',
options: {
exposes: 'VirtualMachine'
}
}
])
}
@ -97,11 +100,17 @@ module.exports = [
rules: base.module.rules.concat([
{
test: require.resolve('./src/index.js'),
loader: 'expose-loader?exposes=VirtualMachine'
loader: 'expose-loader',
options: {
exposes: 'VirtualMachine'
}
},
{
test: require.resolve('./src/extensions/scratch3_video_sensing/debug.js'),
loader: 'expose-loader?exposes=Scratch3VideoSensingDebug'
loader: 'expose-loader',
options: {
exposes: 'Scratch3VideoSensingDebug'
}
},
{
test: require.resolve('stats.js/build/stats.min.js'),
@ -109,19 +118,31 @@ module.exports = [
},
{
test: require.resolve('scratch-blocks/dist/vertical.js'),
loader: 'expose-loader?exposes=Blockly'
loader: 'expose-loader',
options: {
exposes: 'Blockly'
}
},
{
test: require.resolve('scratch-audio/src/index.js'),
loader: 'expose-loader?exposes=AudioEngine'
loader: 'expose-loader',
options: {
exposes: 'AudioEngine'
}
},
{
test: require.resolve('scratch-storage/src/index.js'),
loader: 'expose-loader?exposes=ScratchStorage'
loader: 'expose-loader',
options: {
exposes: 'ScratchStorage'
}
},
{
test: require.resolve('scratch-render/src/index.js'),
loader: 'expose-loader?exposes=ScratchRender'
loader: 'expose-loader',
options: {
exposes: 'ScratchRender'
}
}
])
},