forked from toolness/p5.js-widget
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (57 loc) · 1.41 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
var _ = require('underscore');
var webpack = require('webpack');
var production = process.env.NODE_ENV === 'production';
var baseConfig = {
resolve: {
// Add `.ts` and `.tsx` as a resolvable extension.
extensions: ['', '.webpack.js', '.web.js', '.ts', '.tsx', '.js']
},
devtool: 'source-map',
module: {
loaders: [
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
{ test: /\.tsx?$/, loader: 'ts-loader' },
{
test: /\.css$/,
loaders: ["style", "css?sourceMap", "postcss?sourceMap"]
}
]
},
plugins: [
].concat(
production ? [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
] : []
),
postcss: function () {
return [require('autoprefixer'),
require('postcss-custom-properties')];
}
};
var configurations = function() {
return [].slice.call(arguments).map(function(config) {
return _.extend(config, baseConfig);
});
};
module.exports = configurations({
entry: {
'main': './lib/main.tsx',
'preview-frame': './lib/preview-frame.ts',
'tests': './test/main.tsx'
},
output: {
filename: '[name].bundle.js'
}
},
{
// The p5-widget.js file is directly referenced by widget embedders, so
// we want the filename and path to be as simple as possible.
entry: './lib/p5-widget.ts',
output: {
filename: 'p5-widget.js'
}
});