2019-01-04 02:25:17 -05:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2018-04-30 12:39:45 -04:00
|
|
|
const defaultsDeep = require('lodash.defaultsdeep');
|
2017-09-05 11:57:48 -04:00
|
|
|
const path = require('path');
|
|
|
|
|
2018-04-30 12:39:45 -04:00
|
|
|
const base = {
|
|
|
|
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
|
2019-01-04 02:25:17 -05:00
|
|
|
devServer: {
|
|
|
|
contentBase: false,
|
|
|
|
host: '0.0.0.0',
|
|
|
|
port: process.env.PORT || 8576
|
|
|
|
},
|
2018-04-30 12:39:45 -04:00
|
|
|
devtool: 'cheap-module-source-map',
|
|
|
|
entry: {
|
|
|
|
'scratch-svg-renderer': './src/index.js'
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [{
|
2018-05-14 12:14:33 -04:00
|
|
|
include: [
|
|
|
|
path.resolve('src'),
|
|
|
|
path.resolve('node_modules', 'scratch-render-fonts')
|
|
|
|
],
|
2018-04-30 12:39:45 -04:00
|
|
|
test: /\.js$/,
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
2024-03-07 15:42:39 -08:00
|
|
|
presets: [['@babel/preset-env', {targets: {}}]]
|
2018-04-30 12:39:45 -04:00
|
|
|
}
|
|
|
|
}]
|
2019-01-04 02:25:17 -05:00
|
|
|
},
|
|
|
|
plugins: []
|
2017-09-05 11:57:48 -04:00
|
|
|
};
|
2018-01-04 11:00:45 -08:00
|
|
|
|
2019-01-04 02:25:17 -05:00
|
|
|
module.exports = [
|
|
|
|
defaultsDeep({}, base, {
|
|
|
|
target: 'web',
|
|
|
|
output: {
|
|
|
|
library: 'ScratchSVGRenderer',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
path: path.resolve('playground'),
|
2019-03-14 16:51:47 -07:00
|
|
|
publicPath: '/',
|
2019-01-04 02:25:17 -05:00
|
|
|
filename: '[name].js'
|
|
|
|
},
|
|
|
|
plugins: base.plugins.concat([
|
|
|
|
new CopyWebpackPlugin([
|
|
|
|
{
|
|
|
|
from: 'src/playground'
|
|
|
|
}
|
|
|
|
])
|
|
|
|
])
|
|
|
|
}),
|
2018-04-30 12:39:45 -04:00
|
|
|
defaultsDeep({}, base, {
|
2018-01-04 11:00:45 -08:00
|
|
|
output: {
|
|
|
|
library: 'ScratchSVGRenderer',
|
|
|
|
libraryTarget: 'umd',
|
|
|
|
path: path.resolve('dist', 'web'),
|
|
|
|
filename: '[name].js'
|
2018-04-30 12:39:45 -04:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [{
|
|
|
|
options: {
|
|
|
|
presets: [['env', {targets: {browsers: ['last 3 versions', 'Safari >= 8', 'iOS >= 8']}}]]
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
optimization: {
|
|
|
|
minimize: process.env.NODE_ENV === 'production'
|
2018-01-04 11:00:45 -08:00
|
|
|
}
|
2019-01-04 02:25:17 -05:00
|
|
|
})
|
|
|
|
];
|