-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathwebpack-prod.config.js
59 lines (55 loc) · 2.02 KB
/
webpack-prod.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
const path = require("path");
const webpack=require("webpack");
const use= [
{ loader: "babel-loader",
}
]
module.exports = {
mode: 'development',
context: path.resolve(__dirname, "app"),
entry: {
main: "./client/main.js",
// item: "./vtest/item.jsx" // split chunks can't be disable if there is more than one entry point
},
devtool: 'source-map',
output: {
path: path.join(__dirname, "assets/webpack"),
filename: "[name].js"
},
module: {
rules: [
{
test: /\.jsx$/,
exclude: /node_modules/,
include: name=>{console.info(name);if(name.includes('profile'))return true; else return false}, // for some reason, webpack (4.25.1) will exclude files with names containing 'profile' (or 'profile-' not sure) so I has to explicitly include them
use,
},
{
test: /\.js$/,
exclude: /node_modules/,
use,
},
{
test: /\.jsx$/,
exclude: /node_modules/,
use,
}
]
},
resolve: {
extensions: ['.*','.js','.jsx'],
fallback: {
fs: false,
"path": require.resolve("path-browserify")
}
},
node: false,
plugins:[
new webpack.IgnorePlugin({resourceRegExp: /clustered|dateFile|file|fileSync|gelf|hipchat|logFacesAppender|loggly|logstashUDP|mailgun|multiprocess|slack|smtp/},/(.*log4js.*)/), // these appenders are require()ed by log4js but not used by this app
new webpack.IgnorePlugin({resourceRegExp: /nodemailer/}), // not used in the client side - those should be move outside of the app directory
// using a function because when this ran on heroku using just "../modules/client-side-model" failed
new webpack.NormalModuleReplacementPlugin(/.+models\/.+/, resource => {
resource.request = "../models/client-side-model";
}),
],
};