forked from CoinSpace/CoinSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.dev.js
80 lines (78 loc) · 1.8 KB
/
webpack.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
const Dotenv = require('dotenv-webpack');
const webpack = require('webpack');
const { merge } = require('webpack-merge');
const autoprefixer = require('autoprefixer');
const common = require('./webpack.common.js');
const pkg = require('./package.json');
const path = require('path');
const dotEnv = new Dotenv({
path: '.env.loc',
safe: true,
defaults: true,
});
module.exports = merge(common, {
mode: 'development',
snapshot: {
managedPaths: [path.resolve(__dirname, '../node_modules')],
},
target: 'web',
output: {
publicPath: '/',
},
devServer: {
open: true,
allowedHosts: 'all',
static: false,
hot: true,
port: 8000,
proxy: {
'/api': {
target: 'http://localhost:8080',
pathRewrite: {
'^/api/v3': '/api/v3',
'^/api/v2': '/api/v2',
'^/api/v1': '/api/v1',
'^/api': '',
},
},
},
},
module: {
rules: [
{
test: /\.(sass|scss)$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: [
autoprefixer,
],
},
},
},
{
loader: 'sass-loader',
},
],
},
],
},
plugins: [
dotEnv,
new webpack.DefinePlugin({
'process.env.BUILD_TYPE': JSON.stringify('web'),
'process.env.BUILD_PLATFORM': JSON.stringify('web'),
'process.env.PLATFORM': JSON.stringify('web-web'),
'process.env.RELEASE': JSON.stringify(`${pkg.name}.web-web@${pkg.version}`),
'process.env.SENTRY_DSN': JSON.stringify(dotEnv.getEnvs().env.SENTRY_DSN),
}),
],
});