This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
/
webpack.config.js
113 lines (112 loc) · 3.7 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const path = require('path');
const webpack = require('webpack');
const Dotenv = require('dotenv-webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
mode: 'development',
entry: path.join(__dirname, 'src/index.js'),
output: {
path: path.resolve(__dirname, 'www'),
filename: 'index.js',
publicPath: 'auto',
},
devtool: 'source-map',
target: 'web',
module: {
rules: [
{
test: /\.(js|jsx|cjs|mjs)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
},
{
test: /\.(css|scss|sass)$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
plugins: [
new Dotenv(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
}),
new CopyWebpackPlugin({
patterns: [
{
from: 'node_modules/@deriv/deriv-charts/dist/',
to: path.resolve(__dirname, 'www/js'),
},
{
from: 'node_modules/@deriv/deriv-charts/dist/chart/assets',
to: path.resolve(__dirname, 'www/assets'),
},
{
from: 'public',
to: path.resolve(__dirname, 'www/public'),
globOptions: {
ignore: ['**/*.html'],
},
},
{
from: 'public/index.html',
to: path.resolve(__dirname, 'www'),
},
{
from: 'public/beta.html',
to: path.resolve(__dirname, 'www'),
},
{
from: 'public/localstorage-sync.html',
to: path.resolve(__dirname, 'www'),
},
{
from: 'blockly-translations',
to: path.resolve(__dirname, 'www/blockly-translations'),
},
{
from: 'temp/blockly.js',
to: path.resolve(__dirname, 'www/'),
},
],
}),
],
devServer: {
port: 80,
host: 'localbot.binary.sx',
open: true,
historyApiFallback: true,
client: {
logging: 'log',
},
static: {
directory: path.join(__dirname, 'www'),
},
},
resolve: {
extensions: ['.js', '.jsx'],
alias: {
'@lang': path.resolve(__dirname, 'src/common/lang'),
'@config': path.resolve(__dirname, 'src/config'),
'@utils': path.resolve(__dirname, 'src/utils'),
'@storage': path.resolve(__dirname, 'src/storage'),
'@constants': path.resolve(__dirname, 'src/constants'),
'@i18n': path.resolve(__dirname, 'src/i18n'),
'@api-base': path.resolve(__dirname, 'src/api-base'),
'@components': path.resolve(__dirname, 'src/components'),
'@redux-store': path.resolve(__dirname, 'src/redux-store'),
'@blockly': path.resolve(__dirname, 'src/blockly'),
'@utilities': path.resolve(__dirname, 'src/utilities'),
'@currency-config': path.resolve(__dirname, 'src/currency-config'),
},
},
};