-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathwebpack.dev.config.js
54 lines (51 loc) · 1.18 KB
/
webpack.dev.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
const path = require('path');
const env = require('dotenv').config({ path: './.env' });
const webpack = require('webpack');
const { version } = require('./package.json');
const CopyPlugin = require('copy-webpack-plugin');
function getParsedEnv() {
if (!env.error) {
return {
...env.parsed,
VERSION: version,
IS_EU_ITERABLE_SERVICE: process.env.IS_EU_ITERABLE_SERVICE || false
};
}
return { VERSION: version };
}
module.exports = {
mode: 'development',
entry: './dist/index.js',
output: {
filename: './index.js',
path: path.resolve(__dirname),
library: '@iterable/web-sdk',
libraryTarget: 'umd',
hotUpdateChunkFilename: 'hot/hot-update.js',
hotUpdateMainFilename: 'hot/hot-update.json'
},
devServer: {
port: 8000,
client: {
overlay: {
errors: true,
warnings: false
}
},
devMiddleware: {
writeToDisk: true
}
},
devtool: 'eval',
plugins: [
new webpack.DefinePlugin({
'process.env': JSON.stringify(getParsedEnv())
}),
new CopyPlugin({
patterns: [{ from: './src/assets', to: './dist/assets' }]
})
],
watchOptions: {
ignored: /node_modules/
}
};