-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.base.babel.js
61 lines (54 loc) · 1.25 KB
/
webpack.config.base.babel.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
'use strict';
import webpack from 'webpack';
import path from 'path';
import pkg from './package';
import * as fp from 'lodash/fp';
const {
name: MODULE_NAME,
config: {
dirs: DIRS
}
} = pkg;
function customizer(objValue, srcValue) {
if (fp.isArray(objValue)) {
return objValue.concat(srcValue);
}
}
const resolve = {
extensions: ['', '.js']
};
const webpackModule = {
loaders: [{
loader: 'babel-loader',
query: {
compact: false,
cacheDirectory: true
},
include: [
path.resolve(__dirname, DIRS.src),
path.resolve(__dirname, DIRS.extensions)
],
exclude: /node_modules/,
test: /\.js?$/
}]
};
const webpackBaseConfig = {
entry: {
[MODULE_NAME]: [path.resolve(__dirname, `${DIRS.src}/index`)]
},
output: {
path: path.resolve(__dirname, DIRS.dest),
library: MODULE_NAME,
libraryTarget: 'umd'
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.BannerPlugin(
`${pkg.name} - v${pkg.version} * ${pkg.homepage} * (c) ${new Date().getFullYear()} ${pkg.author.name} * licensed ${pkg.license}`
),
new webpack.NoErrorsPlugin()
],
module: webpackModule,
resolve
};
export { webpackBaseConfig, webpackModule, resolve, customizer, MODULE_NAME };