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');
|
2017-12-03 12:07:10 +03:00
|
|
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
2017-08-06 13:13:40 +03:00
|
|
|
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
|
|
|
|
},
|
2017-12-03 12:07:10 +03:00
|
|
|
{
|
|
|
|
entry: './src/index.js',
|
|
|
|
output: {
|
|
|
|
filename: './dist/html2canvas.min.js',
|
|
|
|
library: 'html2canvas',
|
|
|
|
libraryTarget: 'umd'
|
|
|
|
},
|
|
|
|
module: modules,
|
|
|
|
plugins: plugins.concat([new UglifyJSPlugin(), new webpack.BannerPlugin(banner)])
|
|
|
|
},
|
2017-08-06 19:26:09 +03:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
];
|