1
|
|
|
/* |
2
|
|
|
* https://github.com/rochars/riff-chunks |
3
|
|
|
* Copyright (c) 2017-2018 Rafael da Silva Rocha. |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* @fileoverview webpack configuration file. |
8
|
|
|
* Three dist files are created: |
9
|
|
|
* - riff-chunks.cjs.js, CommonJS dist for Node. No dependencies included. |
10
|
|
|
* - riff-chunks.umd.js, UMD with dependencies included. |
11
|
|
|
* - riff-chunks.min.js, Compiled for browsers. All dependencies included. |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
const ClosureCompiler = require('google-closure-compiler-js').webpack; |
15
|
|
|
|
16
|
|
|
module.exports = [ |
17
|
|
|
// CommonJS dist, no dependencies in the bundle. |
18
|
|
|
// Will be the one in the "main" field of package.json. |
19
|
|
|
{ |
20
|
|
|
target: 'node', |
21
|
|
|
entry: './main.js', |
22
|
|
|
output: { |
23
|
|
|
filename: './dist/riff-chunks.cjs.js', |
24
|
|
|
libraryTarget: "commonjs" |
25
|
|
|
}, |
26
|
|
|
externals: { |
27
|
|
|
'byte-data': 'byte-data', |
28
|
|
|
}, |
29
|
|
|
}, |
30
|
|
|
// UMD with dependencies in the bundle. |
31
|
|
|
// Will be the one in the "browser" field of package.json. |
32
|
|
|
{ |
33
|
|
|
entry: './main.js', |
34
|
|
|
resolve: { |
35
|
|
|
mainFields: ['module', 'main'] |
36
|
|
|
}, |
37
|
|
|
output: { |
38
|
|
|
filename: './dist/riff-chunks.umd.js', |
39
|
|
|
library: "riffChunks", |
40
|
|
|
libraryTarget: "umd" |
41
|
|
|
} |
42
|
|
|
}, |
43
|
|
|
// Browser dist with dependencies, compiled. |
44
|
|
|
{ |
45
|
|
|
entry: './main.js', |
46
|
|
|
resolve: { |
47
|
|
|
mainFields: ['module', 'main'] |
48
|
|
|
}, |
49
|
|
|
output: { |
50
|
|
|
filename: './dist/riff-chunks.min.js', |
51
|
|
|
library: "riffChunks", |
52
|
|
|
libraryTarget: "window" |
53
|
|
|
}, |
54
|
|
|
plugins: [ |
55
|
|
|
new ClosureCompiler({ |
56
|
|
|
options: { |
57
|
|
|
languageIn: 'ECMASCRIPT6', |
58
|
|
|
languageOut: 'ECMASCRIPT5', |
59
|
|
|
compilationLevel: 'ADVANCED', |
60
|
|
|
warningLevel: 'VERBOSE', |
61
|
|
|
exportLocalPropertyDefinitions: true, |
62
|
|
|
generateExports: true |
63
|
|
|
}, |
64
|
|
|
}) |
65
|
|
|
] |
66
|
|
|
}, |
67
|
|
|
]; |
68
|
|
|
|