-
Notifications
You must be signed in to change notification settings - Fork 22
/
webpack.config.js
68 lines (63 loc) · 1.5 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
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');
const config = {
entry: [
'url-polyfill',
'url-search-params-polyfill',
'./src/sass/embedded.scss',
'./src/embedded.js',
],
output: {
path: path.join(__dirname, 'umd'),
filename: 'embedded.js',
library: 'HelloSign',
libraryExport: 'default',
libraryTarget: 'umd',
globalObject: 'typeof self !== \'undefined\' ? self : this',
},
module: {
rules: [
{
test: /\.js$/,
// Ordinarily we would `exclude: /node_modules/`
// here, however some dependencies use ES6 and
// other new syntax. To ensure that our lib works
// for as many users as possible, we pipe node
// modules through Babel as well. See #99.
use: 'babel-loader',
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [
new webpack.DefinePlugin({
__PKG_NAME__: JSON.stringify(pkg.name),
__PKG_VERSION__: JSON.stringify(pkg.version),
}),
],
};
const devConfig = {
...config,
name: 'dev',
mode: 'development',
devtool: 'inline-source-map',
output: {
...config.output,
filename: 'embedded.development.js',
},
};
const prodConfig = {
...config,
name: 'prod',
mode: 'production',
devtool: 'none',
output: {
...config.output,
filename: 'embedded.production.min.js',
},
};
module.exports = [devConfig, prodConfig];