html2canvas/webpack.config.js

60 lines
1.4 KiB
JavaScript
Raw Normal View History

2017-07-29 05:07:42 +03:00
const webpack = require('webpack');
2017-08-06 13:13:40 +03:00
const fs = require('fs');
const path = require('path');
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json')));
const banner =
`${pkg.title} ${pkg.version} <${pkg.homepage}>
Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}>
Released under ${pkg.license} License`;
2017-07-29 05:07:42 +03:00
2017-08-06 19:26:09 +03:00
const plugins = [
new webpack.DefinePlugin({
'__DEV__': true,
'__VERSION__': JSON.stringify(pkg.version)
}),
new webpack.BannerPlugin(banner)
];
const modules = {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}]
2017-07-29 05:07:42 +03:00
};
2017-08-06 19:26:09 +03:00
module.exports = [
{
entry: './src/index.js',
output: {
filename: './dist/html2canvas.js',
library: 'html2canvas',
libraryTarget: 'umd'
},
module: modules,
plugins
},
{
entry: './src/renderer/RefTestRenderer.js',
output: {
filename: './dist/RefTestRenderer.js',
library: 'RefTestRenderer',
libraryTarget: 'umd'
},
module: modules,
plugins
2017-08-08 19:50:31 +03:00
},
{
entry: './tests/testrunner.js',
output: {
filename: './build/testrunner.js',
library: 'testrunner',
libraryTarget: 'umd'
},
module: modules,
plugins
2017-08-06 19:26:09 +03:00
}
];