forked from paypal/paypal-messaging-components
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.dev.js
57 lines (52 loc) · 1.83 KB
/
webpack.config.dev.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
const { getWebpackConfig } = require('grumbler-scripts/config/webpack.config');
const mockImadserv = require('./utils/proxyImadserv');
const globals = require('./globals');
const FILE_NAME = 'sdk';
const PROTOCOL = 'https';
const HOSTNAME = 'localhost.paypal.com';
const PORT = 8080;
module.exports = (env = {}) => {
const config = env.standalone
? getWebpackConfig({
entry: env.legacy ? './src/legacy/index.js' : './src/index.js',
filename: env.legacy ? 'merchant.js' : 'messaging.js',
libraryTarget: 'window',
modulename: env.legacy ? undefined : ['paypal', 'Messages'],
debug: true,
minify: true,
env: 'local',
vars: globals(env)
})
: getWebpackConfig({
entry: './paypal.dev.js',
filename: `${FILE_NAME}.js`,
debug: true,
minify: false,
env: 'local',
vars: {
...globals(env),
__PROTOCOL__: PROTOCOL,
__HOST__: `${HOSTNAME}:${PORT}`,
__SDK_HOST__: `${HOSTNAME}:${PORT}`,
__PORT__: PORT,
__PATH__: `/${FILE_NAME}.js`,
__NAMESPACE__: 'paypal',
__VERSION__: '1.0.55',
__COMPONENTS__: ['messages']
}
});
config.output.libraryExport = env.standalone ? 'Messages' : '';
config.devServer = {
contentBase: './demo',
publicPath: '/',
openPage: env.standalone ? (env.legacy && 'legacy.html') || 'standalone.html' : '',
compress: true,
host: 'localhost.paypal.com',
port: 8080,
open: true,
overlay: true,
watchContentBase: true,
before: mockImadserv
};
return config;
};