scratch-svg-renderer/webpack.config.js

73 lines
1.6 KiB
JavaScript
Raw Normal View History

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');
const ScratchWebpackConfigBuilder = require('scratch-webpack-configuration');
2017-09-05 11:57:48 -04:00
const common = {
libraryName: 'scratch-svg-renderer',
rootPath: path.resolve(__dirname)
2017-09-05 11:57:48 -04:00
};
/**
* @type {import('webpack').Configuration}
*/
const nodeConfig = new ScratchWebpackConfigBuilder(common)
.setTarget('node')
.merge({
output: {
library: {
name: 'ScratchSVGRenderer',
type: 'umd'
}
}
})
.get();
/**
* @type {import('webpack').Configuration}
*/
const webConfig = new ScratchWebpackConfigBuilder(common)
.setTarget('browserslist')
.merge({
output: {
library: {
name: 'ScratchSVGRenderer',
type: 'umd'
}
}
})
.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
},
output: {
path: path.resolve(__dirname, 'playground'),
library: {
name: 'ScratchSVGRenderer',
type: 'umd'
},
publicPath: '/'
}
2019-01-04 02:25:17 -05:00
})
.addPlugin(
new CopyWebpackPlugin([
{
from: 'src/playground'
}
])
)
.get();
module.exports = [
nodeConfig,
webConfig,
playgroundConfig
2019-01-04 02:25:17 -05:00
];