-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
120 lines (120 loc) · 3.82 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
114
115
116
117
118
119
120
const webpack = require("webpack");
const OptimizeCssAssetsPlugin = require("optimize-css-assets-webpack-plugin");
const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
.BundleAnalyzerPlugin;
const CompressionPlugin = require("compression-webpack-plugin");
const path = require("path");
module.exports = (env, argv) => {
return {
// devtool: argv.mode == `development` ? `inline-source-map` : `source-map`,
cache: false,
resolve: {
fallback: {
fs: false,
stream: require.resolve("stream-browserify"),
path: require.resolve("path-browserify"),
zlib: require.resolve("browserify-zlib")
},
alias: {
modernizr$: path.resolve(__dirname, "./.modernizrrc.js"),
jquery$: path.resolve(__dirname, "./node_modules/jquery"),
codeAnalyzer: path.resolve(__dirname, "./src/JS/codeAnalyzer"),
commands: path.resolve(__dirname, "./src/JS/commands"),
components: path.resolve(__dirname, "./src/JS/components"),
core: path.resolve(__dirname, "./src/JS/core"),
event: path.resolve(__dirname, "./src/JS/events"),
media: path.resolve(__dirname, "./src/Media"),
FX: path.resolve(__dirname, "./src/JS/FX"),
measurements: path.resolve(__dirname, "./src/JS/measurements"),
parsers: path.resolve(__dirname, "./src/JS/parsers"),
providers: path.resolve(__dirname, "./src/JS/providers"),
thirdParty: path.resolve(__dirname, "./src/JS/thirdParty"),
translations: path.resolve(__dirname, "./src/JS/translations"),
CSS: path.resolve(__dirname, "./src/CSS")
}
},
plugins: [
/* new BundleAnalyzerPlugin({
analyzerMode: 'static'
}), */
new CompressionPlugin(),
new OptimizeCssAssetsPlugin(),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
XRegExp: "xregexp"
})
],
entry: ["core-js/stable", "regenerator-runtime/runtime", "./src/app.js"],
target: "web",
module: {
rules: [{
test: /\.js$/,
exclude: [
path.resolve(__dirname, "./src/JS/Third Party/CLD/cld-min.js")
],
loader: "babel-loader",
options: {
presets: ["@babel/preset-react"],
plugins: ["@babel/plugin-proposal-class-properties"],
compact: false
}
},
{
test: /cld-min\.js/,
loader: "script-loader"
},
{
loader: "webpack-modernizr-loader",
test: /\.modernizrrc\.js$/
},
{
test: [
path.resolve(__dirname, "./node_modules/firebaseui/dist/npm.js")
],
loader: "string-replace-loader",
options: {
search: `var l=this`,
replace: `var l=window`,
strict: true
}
},
{
test: /datedropper\.js$/,
loader: "string-replace-loader",
options: {
search: `$(this).is('input')`,
replace: `($(this).is('paper-input')||$(this).is('input'))`,
strict: true
}
},
{
test: /arli\.js$/,
loader: "string-replace-loader",
options: {
search: `['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹']`,
replace: `['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩']`,
strict: true
}
},
{
test: /\.(css)$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.pegjs$/,
loader: "pegjs-loader"
},
{
test: /\.(jpg|png|svg|mp4|m4a|woff|woff2|eot|ttf|wav)$/,
type: 'asset/inline'
},
{
test: /\.rive$/,
type: 'asset/source'
}
]
}
};
};