forked from sony/cdp-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
107 lines (105 loc) · 2.73 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
const webpack = require('webpack');
const path = require('path');
const banner = require('./tasks/banner');
const config = require('./project.config');
const TARGET = config.target.env;
const MAIN_ENTRY = path.join(__dirname, config.dir.built, config.main.basename + '.js');
const OUTPUT_PATH = path.join(__dirname, config.dir.pkg);
const OUTPUT_FILE_NAME = config.main.basename + '.js';
const OUTPUT_LIB_TARGET = ('commonjs' === config.target.module) ? 'commonjs2' : config.target.module;
module.exports = {
target: TARGET,
entry: [
MAIN_ENTRY,
],
output: {
path: OUTPUT_PATH,
filename: OUTPUT_FILE_NAME,
libraryTarget: OUTPUT_LIB_TARGET,
},
node: {
__dirname: false,
__filename: false,
},
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.js$/,
use: ["source-map-loader"],
enforce: "pre",
},
],
},
externals: {
// external module defs here:
'fs-extra': {
commonjs: 'fs-extra',
commonjs2: 'fs-extra',
},
'jquery': {
root: 'jQuery',
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery'
},
'hogan.js': {
root: 'Hogan',
commonjs: 'hogan.js',
commonjs2: 'hogan.js',
amd: 'hogan.js'
},
'jsdom': {
commonjs: 'jsdom',
commonjs2: 'jsdom',
},
'xmldom': {
commonjs: 'xmldom',
commonjs2: 'xmldom',
},
'glob': {
commonjs: 'glob',
commonjs2: 'glob',
},
'lodash': {
root: '_',
commonjs: 'lodash',
commonjs2: 'lodash',
},
'uuid': {
commonjs: 'uuid',
commonjs2: 'uuid',
},
'semver-regex': {
commonjs: 'semver-regex',
commonjs2: 'semver-regex',
},
'underscore.string': {
root: '_',
commonjs: 'underscore.string',
commonjs2: 'underscore.string',
},
'which': {
commonjs: 'which',
commonjs2: 'which',
},
'chalk': {
commonjs: 'chalk',
commonjs2: 'chalk',
},
'cli-spinner': {
commonjs: 'cli-spinner',
commonjs2: 'cli-spinner',
},
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new webpack.BannerPlugin({
banner: banner('.js'),
raw: true,
ntryOnly: true,
}),
],
};