forked from dekkerglen/CubeCobra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.common.js
95 lines (91 loc) · 2.76 KB
/
webpack.common.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
const path = require('path');
const merge = require('webpack-merge');
const nodeExternals = require('webpack-node-externals');
const config = {
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules[\/\\](?!react-dnd|dnd-core)/,
use: {
loader: 'babel-loader',
options: {
configFile: path.resolve(__dirname, 'babel.config.js'),
},
},
},
{
test: /\.(css|less)$/,
use: ['style-loader', 'css-loader'],
},
],
},
devtool: 'source-map',
resolve: {
modules: ['src', 'node_modules'],
},
};
const clientConfig = merge(config, {
entry: {
blogpost: './src/blogpost.js',
bulk_upload: './src/bulk_upload.js',
cardpage: './src/cardpage.js',
cube_samplepack: './src/cube_samplepack.js',
cube_analysis: './src/cube_analysis.js',
cube_blog: './src/cube_blog.js',
cube_compare: './src/cube_compare.js',
cube_deck: './src/cube_deck.js',
cube_decks: './src/cube_decks.js',
cube_deckbuilder: './src/cube_deckbuilder.js',
cube_draft: './src/cube_draft.js',
cube_list: './src/cube_list.js',
cube_overview: './src/cube_overview.js',
cube_playtest: './src/cube_playtest.js',
dashboard: './src/dashboard.js',
notifications: './src/notifications.js',
topcards: './src/topcards.js',
user_account: './src/user_account.js',
user_decks: './src/user_decks.js',
user_social: './src/user_social.js',
user_view: './src/user_view.js',
explore: './src/explore.js',
search: './src/search.js',
version: './src/version.js',
},
output: {
filename: '[name].bundle.js',
sourceMapFilename: '[name].js.map',
path: path.resolve(__dirname, 'dist'),
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
},
});
const serverConfig = merge(config, {
target: 'node',
entry: {
'pages/BulkUploadPage': './src/pages/BulkUploadPage.js',
'pages/CubeDraftPage': './src/pages/CubeDraftPage.js',
'pages/CubeListPage': './src/pages/CubeListPage.js',
'pages/CubePlaytestPage': './src/pages/CubePlaytestPage.js',
'pages/DashboardPage': './src/pages/DashboardPage.js',
'utils/Card': './src/utils/Card.js',
'utils/draftutil': './src/utils/draftutil.js',
'filtering/FilterCards': './src/filtering/FilterCards.js',
'utils/Sort': './src/utils/Sort.js',
'utils/Util': './src/utils/Util.js',
},
output: {
filename: '[name].js',
sourceMapFilename: '[name].js.map',
path: path.resolve(__dirname, 'dist'),
libraryTarget: 'commonjs2',
},
externals: [
nodeExternals({
whitelist: ['react-tag-input', 'react-dnd', 'dnd-core', 'react-dnd-html5-backend', 'react-dnd-touch-backend'],
}),
],
});
module.exports = { clientConfig, serverConfig };