-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.config.js
66 lines (60 loc) · 1.5 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
const path = require('path');
const dotenv = require('dotenv');
const webpack = require('webpack');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
dotenv.config();
const src = path.join(__dirname, 'src/client');
const build = path.join(__dirname, 'build/client');
// Shared configs
const tsLoader = {
test: /\.tsx?$/,
loader: [
'babel-loader',
{
loader: 'ts-loader',
options: {
configFile: path.join(src, 'tsconfig.json'),
},
},
],
};
const scssLoader = {
test: /\.(s)?css$/,
loader: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
};
// Client config
module.exports = {
name: 'client',
target: 'web',
entry: path.join(src, 'index.tsx'),
output: {
path: build,
filename: 'script.js',
},
module: {
rules: [tsLoader, scssLoader],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
SHIRT_COST: JSON.stringify(process.env.SHIRT_COST),
CONTACT_TWITTER: JSON.stringify(process.env.CONTACT_TWITTER),
CONTACT_EMAIL: JSON.stringify(process.env.CONTACT_EMAIL),
LND_CONNECTION_STRING: JSON.stringify(process.env.LND_CONNECTION_STRING),
},
}),
new MiniCssExtractPlugin({ filename: 'style.css' }),
new CopyWebpackPlugin([{
from: path.join(src, 'images'),
to: path.join(build, 'images'),
}]),
],
};