2019-01-04 02:25:17 -05:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2017-09-05 11:57:48 -04:00
|
|
|
const path = require('path');
|
2024-03-07 15:53:06 -08:00
|
|
|
const ScratchWebpackConfigBuilder = require('scratch-webpack-configuration');
|
2017-09-05 11:57:48 -04:00
|
|
|
|
2024-03-07 15:53:06 -08:00
|
|
|
const common = {
|
2024-06-26 16:42:19 +03:00
|
|
|
libraryName: 'scratch-svg-renderer',
|
2024-03-07 15:53:06 -08:00
|
|
|
rootPath: path.resolve(__dirname)
|
2017-09-05 11:57:48 -04:00
|
|
|
};
|
2018-01-04 11:00:45 -08:00
|
|
|
|
2024-03-07 15:53:06 -08:00
|
|
|
/**
|
|
|
|
* @type {import('webpack').Configuration}
|
|
|
|
*/
|
|
|
|
const nodeConfig = new ScratchWebpackConfigBuilder(common)
|
|
|
|
.setTarget('node')
|
2024-06-26 16:42:19 +03:00
|
|
|
.merge({
|
|
|
|
output: {
|
|
|
|
library: {
|
|
|
|
name: 'ScratchSVGRenderer',
|
|
|
|
type: 'umd'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2024-03-07 15:53:06 -08:00
|
|
|
.get();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {import('webpack').Configuration}
|
|
|
|
*/
|
|
|
|
const webConfig = new ScratchWebpackConfigBuilder(common)
|
|
|
|
.setTarget('browserslist')
|
2024-06-26 16:42:19 +03:00
|
|
|
.merge({
|
|
|
|
output: {
|
|
|
|
library: {
|
|
|
|
name: 'ScratchSVGRenderer',
|
|
|
|
type: 'umd'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2024-03-07 15:53:06 -08:00
|
|
|
.get();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @type {import('webpack').Configuration}
|
|
|
|
*/
|
|
|
|
const playgroundConfig = new ScratchWebpackConfigBuilder(common)
|
|
|
|
.setTarget('browserslist')
|
|
|
|
.merge({
|
|
|
|
devServer: {
|
|
|
|
contentBase: false,
|
|
|
|
port: process.env.PORT || 8576
|
2019-01-04 02:25:17 -05:00
|
|
|
},
|
2018-01-04 11:00:45 -08:00
|
|
|
output: {
|
2024-03-07 15:53:06 -08:00
|
|
|
path: path.resolve(__dirname, 'playground'),
|
2024-06-26 16:42:19 +03:00
|
|
|
library: {
|
|
|
|
name: 'ScratchSVGRenderer',
|
|
|
|
type: 'umd'
|
|
|
|
},
|
2024-03-07 15:53:06 -08:00
|
|
|
publicPath: '/'
|
2018-01-04 11:00:45 -08:00
|
|
|
}
|
2019-01-04 02:25:17 -05:00
|
|
|
})
|
2024-03-07 15:53:06 -08:00
|
|
|
.addPlugin(
|
|
|
|
new CopyWebpackPlugin([
|
|
|
|
{
|
|
|
|
from: 'src/playground'
|
|
|
|
}
|
|
|
|
])
|
|
|
|
)
|
|
|
|
.get();
|
|
|
|
|
|
|
|
module.exports = [
|
|
|
|
nodeConfig,
|
|
|
|
webConfig,
|
|
|
|
playgroundConfig
|
2019-01-04 02:25:17 -05:00
|
|
|
];
|