This repository has been archived by the owner on May 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
69 lines (61 loc) · 1.8 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
62
63
64
65
66
67
68
// webpack.config.js
//
const path = require('path');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const PUBLIC = __dirname + "/build";
const PACKAGE_JSON = require('./package.json');
const BUILD_DEV = !! JSON.parse(process.env.BUILD_DEV || 'true');
const BANNER = `spearwolf/${PACKAGE_JSON.name} version ${PACKAGE_JSON.version} built with ♥ by ${PACKAGE_JSON.author.name} <${PACKAGE_JSON.author.email}>`;
var plugins = [
new webpack.DefinePlugin({
'DEBUG': JSON.stringify(BUILD_DEV),
'__PACKAGE_NAME__': "'"+PACKAGE_JSON.name+"'",
'__PACKAGE_VERSION__': "'"+PACKAGE_JSON.version+"'",
}),
new CopyWebpackPlugin([
{ from: 'examples', to: 'examples' },
{ from: 'assets', to: 'assets' },
{ from: 'index.html' },
]),
new webpack.BannerPlugin(BANNER, {
entryOnly: true
})
];
if (!BUILD_DEV) {
console.log('!!!!! RELEASE BUILD !!!!!\n');
plugins.push(new webpack.optimize.UglifyJsPlugin({
sourceMap: false,
compress: {
warnings: false,
},
}));
}
module.exports = {
entry: "./src/picimo.js",
resolve: {
root: [
path.resolve('./src'),
],
modulesDirectories: [
"node_modules",
]
},
output: {
library: 'Picimo',
libraryTarget: 'umd',
path: PUBLIC,
filename: (BUILD_DEV ? "picimo.js" : "picimo.min.js")
},
plugins: plugins,
devtool: "#inline-source-map",
devServer: {
contentBase: PUBLIC,
host: "0.0.0.0"
},
module: {
loaders: [
{ test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: "babel-loader" },
],
},
};