-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathwebpack.config.js
36 lines (33 loc) · 918 Bytes
/
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
var path = require('path');
var webpack = require('webpack');
var pkg = require('./package.json');
var date = new Date();
var banner = `
${pkg.name} ${pkg.version}
Author: ${pkg.author}
Homepage: ${pkg.homepage}
Release under ${pkg.license}.
update ${date.toLocaleDateString()}
`;
var config = {
devtool: 'cheap-module-eval-source-map',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'fullpage.js',
publicPath: path.resolve(__dirname, 'build'),
},
plugins: [new webpack.BannerPlugin(banner)],
module: {
rules: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }],
},
};
if (process.env.NODE_ENV === 'production') {
config.devtool = null;
config.output = {
path: path.resolve(__dirname, 'build'),
filename: 'fullpage.min.js',
};
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
}
module.exports = config;