scratch-desktop/webpack.renderer.js

51 lines
1.9 KiB
JavaScript
Raw Normal View History

const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const makeConfig = require('./webpack.makeConfig.js');
const getModulePath = moduleName => path.dirname(require.resolve(`${moduleName}/package.json`));
module.exports = defaultConfig =>
makeConfig(
defaultConfig,
{
name: 'renderer',
useReact: true,
disableDefaultRulesForExtensions: ['js', 'jsx', 'css', 'svg', 'png', 'wav', 'gif', 'jpg', 'ttf'],
babelPaths: [
path.resolve(__dirname, 'src', 'renderer'),
/node_modules[\\/]+scratch-[^\\/]+[\\/]+src/,
/node_modules[\\/]+pify/,
/node_modules[\\/]+@vernier[\\/]+godirect/
],
plugins: [
2023-07-24 10:18:24 -04:00
new CopyWebpackPlugin([
{
from: path.join(getModulePath('scratch-blocks'), 'media'),
to: 'static/blocks-media/default'
},
{
from: path.join(getModulePath('scratch-blocks'), 'media'),
to: 'static/blocks-media/high-contrast'
},
{
from: path.join(getModulePath('scratch-gui'),
'src', 'lib', 'themes', 'high-contrast', 'blocks-media'),
to: 'static/blocks-media/high-contrast',
force: true
},
{
from: 'extension-worker.{js,js.map}',
context: path.join(getModulePath('scratch-vm'), 'dist', 'web')
},
{
from: path.join(getModulePath('scratch-gui'), 'src', 'lib', 'libraries', '*.json'),
to: 'static/libraries',
flatten: true
}
])
]
}
);