forked from lbryio/lbry-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.web.config.js
79 lines (75 loc) · 1.86 KB
/
webpack.web.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
const { WEBPACK_WEB_PORT } = require('./config.js');
const path = require('path');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.base.config.js');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const { DefinePlugin, ProvidePlugin } = require('webpack');
const STATIC_ROOT = path.resolve(__dirname, 'static/');
const DIST_ROOT = path.resolve(__dirname, 'dist/');
const WEB_PLATFORM_ROOT = path.resolve(__dirname, 'src/platforms/web/');
const webConfig = {
target: 'web',
entry: {
ui: './src/ui/index.jsx',
},
output: {
filename: '[name].js',
path: __dirname + '/dist/web',
publicPath: '/',
},
devServer: {
port: WEBPACK_WEB_PORT,
},
module: {
rules: [
{
test: /\.(jsx?$|s?css$)/,
use: [
{
loader: 'preprocess-loader',
options: {
TARGET: 'web',
ppOptions: {
type: 'js',
},
},
},
],
},
],
},
resolve: {
modules: [path.resolve(__dirname, 'src/platforms/')],
alias: {
electron: path.resolve(__dirname, 'src/platforms/web/stubs'),
fs: path.resolve(__dirname, 'src/platforms/web/fs'),
},
},
plugins: [
new CopyWebpackPlugin([
{
from: `${STATIC_ROOT}/index-web.html`,
to: `${DIST_ROOT}/web/index.html`,
},
{
from: `${STATIC_ROOT}/img/favicon.ico`,
to: `${DIST_ROOT}/web/favicon.ico`,
},
{
from: `${STATIC_ROOT}/img/og.png`,
to: `${DIST_ROOT}/web/og.png`,
},
{
from: `${WEB_PLATFORM_ROOT}/server.js`,
to: `${DIST_ROOT}/web/server.js`,
},
]),
new DefinePlugin({
IS_WEB: JSON.stringify(true),
}),
new ProvidePlugin({
__: ['i18n.js', '__'],
}),
],
};
module.exports = merge(baseConfig, webConfig);