Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 5
Línea 1... Línea 1...
1
const path = require('path')
1
const path = require("path");
2
const isDevelopment = process.env.NODE_ENV === 'development'
2
const isDevelopment = process.env.NODE_ENV === "development";
3
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
3
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
4
const TerserPlugin = require('terser-webpack-plugin')
4
const TerserPlugin = require("terser-webpack-plugin");
5
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
5
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
Línea 6... Línea 6...
6
 
6
 
7
// Add paths while bundling
7
// change active path here
8
const paths = {
-
 
9
  dashboard: {
-
 
10
    entry: './react-webpack/dashboard/components/index.js',
-
 
11
    output: path.join(__dirname, 'public/react-bundles/dashboard'),
-
 
12
    filename: 'dashboardBundle.js'
-
 
13
  },
-
 
14
  notifications: {
-
 
15
    entry: './react-webpack/notifications/index.js',
-
 
16
    output: path.join(__dirname, 'public/react-bundles/dashboard'),
-
 
17
    filename: 'notificationsBundle.js'
-
 
18
  },
-
 
19
  myProfiles: {
-
 
20
    entry: './react-webpack/profile/my-profiles/my-profiles/index.js',
-
 
21
    output: path.join(
-
 
22
      __dirname,
-
 
23
      'public/react-bundles/my-profiles/my-profiles'
-
 
24
    ),
-
 
25
    filename: 'myProfilesBundle.js'
-
 
26
  },
-
 
27
  peopleViewedProfile: {
-
 
28
    entry: './react-webpack/profile/people-viewed-profile/index.js',
-
 
29
    output: path.join(
-
 
30
      __dirname,
-
 
31
      'public/react-bundles/profile/people-viewed-profile'
-
 
32
    ),
-
 
33
    filename: 'peopleViewedProfileBundle.js'
-
 
34
  },
-
 
35
  profileView: {
-
 
36
    entry: './react-webpack/profile/view/index.js',
-
 
37
    output: path.join(__dirname, 'public/react-bundles/profile/view'),
-
 
38
    filename: 'profileViewBundle.js'
-
 
39
  },
-
 
40
  profileEdit: {
-
 
41
    entry: './react-webpack/profile/my-profiles/edit/index.js',
-
 
42
    output: path.join(__dirname, 'public/react-bundles/profile/edit'),
-
 
43
    filename: 'profileEditBundle.js'
-
 
44
  },
-
 
45
  myConnections: {
-
 
46
    entry: './react-webpack/connection/my-connections/index.js',
-
 
47
    output: path.join(
-
 
48
      __dirname,
-
 
49
      'public/react-bundles/connection/my-connections'
-
 
50
    ),
-
 
51
    filename: 'myConnectionsBundle.js'
-
 
52
  },
-
 
53
  invitationsReceived: {
-
 
54
    entry: './react-webpack/connection/invitations-received/index.js',
-
 
55
    output: path.join(
-
 
56
      __dirname,
-
 
57
      'public/react-bundles/connection/invitations-received'
-
 
58
    ),
-
 
59
    filename: 'invitationsReceivedBundle.js'
-
 
60
  },
-
 
61
  invitationsSent: {
-
 
62
    entry: './react-webpack/connection/invitations-sent/index.js',
-
 
63
    output: path.join(
-
 
64
      __dirname,
-
 
65
      'public/react-bundles/connection/invitations-sent'
-
 
66
    ),
-
 
67
    filename: 'invitationsSentBundle.js'
-
 
68
  },
-
 
69
  peopleYouMayKnow: {
-
 
70
    entry: './react-webpack/connection/people-you-may-know/index.js',
-
 
71
    output: path.join(
-
 
72
      __dirname,
-
 
73
      'public/react-bundles/connection/people-you-may-know'
-
 
74
    ),
-
 
75
    filename: 'peopleYouMayKnowBundle.js'
-
 
76
  },
-
 
77
  peopleBlocked: {
-
 
78
    entry: './react-webpack/connection/people-blocked/index.js',
-
 
79
    output: path.join(
-
 
80
      __dirname,
-
 
81
      'public/react-bundles/connection/people-blocked'
-
 
82
    ),
-
 
83
    filename: 'peopleBlockedBundle.js'
-
 
84
  },
-
 
85
  myCompanies: {
-
 
86
    entry: './react-webpack/company/my-companies/index.js',
-
 
87
    output: path.join(__dirname, 'public/react-bundles/my-companies'),
-
 
88
    filename: 'myCompaniesBundle.js'
-
 
89
  },
-
 
90
  followingCompanies: {
-
 
91
    entry: './react-webpack/company/following-companies/index.js',
-
 
92
    output: path.join(__dirname, 'public/react-bundles/following-companies'),
-
 
93
    filename: 'followingCompaniesBundle.js'
-
 
94
  },
-
 
95
  companiesIWorkWith: {
-
 
96
    entry: './react-webpack/company/i-work-with/index.js',
-
 
97
    output: path.join(__dirname, 'public/react-bundles/company/i-work-with'),
-
 
98
    filename: 'iWorkWithBundle.js'
-
 
99
  },
-
 
100
  companiesRequestSent: {
-
 
101
    entry: './react-webpack/company/request-sent/index.js',
-
 
102
    output: path.join(__dirname, 'public/react-bundles/company/request-sent'),
-
 
103
    filename: 'requestSentBundle.js'
-
 
104
  },
-
 
105
  companiesInvitationsReceived: {
-
 
106
    entry: './react-webpack/company/invitations-received/index.js',
-
 
107
    output: path.join(
-
 
108
      __dirname,
-
 
109
      'public/react-bundles/company/invitations-received'
-
 
110
    ),
-
 
111
    filename: 'invitationsReceivedBundle.js'
-
 
112
  },
-
 
113
  companyView: {
-
 
114
    entry: './react-webpack/company/view/index.js',
-
 
115
    output: path.join(__dirname, 'public/react-bundles/company/view'),
-
 
116
    filename: 'companyViewBundle.js'
-
 
117
  },
-
 
118
  appliedJobs: {
-
 
119
    entry: './react-webpack/job/applied-jobs/index.js',
-
 
120
    output: path.join(__dirname, 'public/react-bundles/job/applied-jobs'),
-
 
121
    filename: 'appliedJobsBundle.js'
-
 
122
  },
-
 
123
  savedJobs: {
-
 
124
    entry: './react-webpack/job/saved-jobs/index.js',
-
 
125
    output: path.join(__dirname, 'public/react-bundles/job/saved-jobs'),
-
 
126
    filename: 'savedJobsBundle.js'
-
 
127
  },
-
 
128
  jobView: {
-
 
129
    entry: './react-webpack/job/view/index.js',
-
 
130
    output: path.join(__dirname, 'public/react-bundles/job/view'),
-
 
131
    filename: 'jobViewBundle.js'
-
 
132
  },
-
 
133
  authSignin: {
-
 
134
    entry: './react-webpack/auth/signin-section/index.js',
-
 
135
    output: path.join(__dirname, 'public/react-bundles/auth/signin'),
-
 
136
    filename: 'signinBundle.js'
-
 
137
  },
-
 
138
  myGroups: {
-
 
139
    entry: './react-webpack/group/my-groups/my-groups/index.js',
-
 
140
    output: path.join(__dirname, 'public/react-bundles/my-groups'),
-
 
141
    filename: 'myGroupsBundle.js'
-
 
142
  },
-
 
143
  groupEdit: {
-
 
144
    entry: './react-webpack/group/my-groups/edit/index.js',
-
 
145
    output: path.join(__dirname, 'public/react-bundles/groupEdit'),
-
 
146
    filename: 'groupEdit.js'
-
 
147
  },
-
 
148
  groupView: {
-
 
149
    entry: './react-webpack/group/view/index.js',
-
 
150
    output: path.join(__dirname, 'public/react-bundles/group/groupView'),
-
 
151
    filename: 'groupView.js'
-
 
152
  },
-
 
153
 
-
 
154
  joinedGroups: {
-
 
155
    entry: './react-webpack/group/joined-groups/index.js',
-
 
156
    output: path.join(__dirname, 'public/react-bundles/group/joined-groups'),
-
 
157
    filename: 'joinedGroupsBundle.js'
-
 
158
  },
-
 
159
  groupRequestsSent: {
-
 
160
    entry: './react-webpack/group/requests-sent/index.js',
-
 
161
    output: path.join(__dirname, 'public/react-bundles/group/requests-sent'),
-
 
162
    filename: 'requestSentBundle.js'
-
 
163
  },
-
 
164
  groupInvitationsReceived: {
-
 
165
    entry: './react-webpack/group/invitations-received/index.js',
-
 
166
    output: path.join(
-
 
167
      __dirname,
-
 
168
      'public/react-bundles/group/invitations-received'
-
 
169
    ),
-
 
170
    filename: 'invitationsReceivedBundle.js'
-
 
171
  },
-
 
172
  accountSettings: {
-
 
173
    entry: './react-webpack/account-settings/index.js',
-
 
174
    output: path.join(__dirname, 'public/react-bundles/account-settings'),
-
 
175
    filename: 'accountSettingsBundle.js'
-
 
176
  },
-
 
177
  navBar: {
-
 
178
    entry: './react-webpack/navbar/index.js',
-
 
179
    output: path.join(__dirname, 'public/react-bundles/navbar'),
-
 
180
    filename: 'navbarBundle.js'
-
 
181
  },
-
 
182
  chat: {
8
const currentPath = {
183
    entry: './react-webpack/chat/index.js',
9
  entry: "./app/index.js",
184
    output: path.join(__dirname, 'public/react-bundles/chat'),
-
 
185
    filename: 'chatBundle.js'
-
 
186
  },
-
 
187
  mobileChat: {
-
 
188
    entry: './react-webpack/mobile-chat/index.js',
-
 
189
    output: path.join(__dirname, 'public/react-bundles/mobileChat'),
-
 
190
    filename: 'mobileChatBundle.js'
-
 
191
  },
-
 
192
  inmail: {
-
 
193
    entry: './react-webpack/inmail/index.js',
-
 
194
    output: path.join(__dirname, 'public/react-bundles/inmail'),
-
 
195
    filename: 'inmailBundle.js'
-
 
196
  },
-
 
197
  marketplace: {
-
 
198
    entry: './react-webpack/marketplace/index.js',
-
 
199
    output: path.join(__dirname, 'public/react-bundles/marketplace'),
-
 
200
    filename: 'marketplaceBundle.js'
-
 
201
  },
-
 
202
  profileMicrolearning: {
-
 
203
    entry: './react-webpack/profile-microlearning/index.js',
-
 
204
    output: path.join(__dirname, 'public/react-bundles/profile-microlearning'),
-
 
205
    filename: 'profileMicrolearningBundle.js'
-
 
206
  },
-
 
207
  resetPassword: {
-
 
208
    entry: './react-webpack/auth/signin-section/signin-section/reset-password/index.js',
-
 
209
    output: path.join(__dirname, 'public/react-bundles/auth/reset-password'),
-
 
210
    filename: 'resetPasswordBundle.js'
-
 
211
  },
-
 
212
  search: {
-
 
213
    entry: './react-webpack/search/index.js',
-
 
214
    output: path.join(__dirname, 'public/react-bundles/search'),
-
 
215
    filename: 'searchBundle.js'
-
 
216
  },
-
 
217
  postView: {
-
 
218
    entry: './react-webpack/dashboard/post/index.js',
-
 
219
    output: path.join(__dirname, 'public/react-bundles/postView'),
-
 
220
    filename: 'postViewBundle.js'
-
 
221
  },
-
 
222
  selfEvaluation: {
-
 
223
    entry: './react-webpack/self-evaluation/index.js',
-
 
224
    output: path.join(__dirname, 'public/react-bundles/self-evaluation'),
10
  output: path.join(__dirname, "public/bundles"),
225
    filename: 'selfEvaluationBundle.js'
-
 
226
  },
-
 
227
  performanceEvaluation: {
-
 
228
    entry: './react-webpack/performance-evaluation/index.js',
-
 
229
    output: path.join(__dirname, 'public/react-bundles/performance-evaluation'),
-
 
230
    filename: 'performanceEvaluationBundle.js'
-
 
231
  },
-
 
232
  impersonate: {
-
 
233
    entry: './react-webpack/impersonate/index.js',
-
 
234
    output: path.join(__dirname, 'public/react-bundles/impersonate'),
-
 
235
    filename: 'impersonateBundle.js'
-
 
236
  }
11
  filename: "applicationBundle.js",
237
}
-
 
238
 
-
 
239
// change active path here  
-
 
Línea 240... Línea 12...
240
const currentPath = paths.marketplace;
12
};
241
 
13
 
242
module.exports = {
14
module.exports = {
243
  entry: currentPath.entry,
15
  entry: currentPath.entry,
244
  output: {
16
  output: {
245
    path: currentPath.output,
17
    path: currentPath.output,
246
    filename: currentPath.filename
18
    filename: currentPath.filename,
247
  },
19
  },
248
  watch: !!isDevelopment,
20
  watch: false,
249
  mode: isDevelopment ? 'development' : 'production',
21
  mode: "production",
250
  resolve: {
22
  resolve: {
251
    extensions: ['.js', '.jsx', '.scss']
23
    extensions: [".js", ".jsx", ".scss"],
252
  },
24
  },
253
  module: {
25
  module: {
254
    rules: [
26
    rules: [
255
      {
27
      {
256
        test: /(js|jsx)$/,
28
        test: /(js|jsx)$/,
257
        use: ['babel-loader'],
29
        use: ["babel-loader"],
258
        exclude: /node_modules/
30
        exclude: /node_modules/,
259
      },
31
      },
260
      {
32
      {
261
        test: /\.css$/i,
33
        test: /\.css$/i,
262
        use: [MiniCssExtractPlugin.loader, 'css-loader']
34
        use: [MiniCssExtractPlugin.loader, "css-loader"],
263
      },
35
      },
264
      {
36
      {
265
        test: /\.module\.s(a|c)ss$/,
37
        test: /\.module\.s(a|c)ss$/,
266
        use: [
38
        use: [
267
          MiniCssExtractPlugin.loader,
39
          MiniCssExtractPlugin.loader,
268
          {
40
          {
269
            loader: 'css-loader',
41
            loader: "css-loader",
270
            options: {
42
            options: {
271
              modules: {
43
              modules: {
272
                localIdentName: '[local]--[hash:base64:5]'
44
                localIdentName: "[local]--[hash:base64:5]",
273
              },
45
              },
274
              sourceMap: isDevelopment
46
              sourceMap: isDevelopment,
275
            }
47
            },
276
          },
48
          },
277
          {
49
          {
278
            loader: 'sass-loader',
50
            loader: "sass-loader",
279
            options: {
51
            options: {
280
              sourceMap: isDevelopment
52
              sourceMap: isDevelopment,
281
            }
53
            },
282
          }
54
          },
283
        ]
55
        ],
284
      },
56
      },
285
      {
57
      {
286
        test: /\.s(a|c)ss$/,
58
        test: /\.s(a|c)ss$/,
287
        exclude: /\.module.(s(a|c)ss)$/,
59
        exclude: /\.module.(s(a|c)ss)$/,
288
        use: [
60
        use: [
289
          MiniCssExtractPlugin.loader,
61
          MiniCssExtractPlugin.loader,
290
          'css-loader',
62
          "css-loader",
291
          {
63
          {
292
            loader: 'sass-loader',
64
            loader: "sass-loader",
293
            options: {
65
            options: {
294
              sourceMap: isDevelopment
66
              sourceMap: isDevelopment,
295
            }
67
            },
296
          }
68
          },
297
        ]
69
        ],
298
      }
70
      },
299
    ]
71
    ],
300
  },
72
  },
301
  plugins: [
-
 
302
    new MiniCssExtractPlugin({
-
 
303
      filename: '[name].css',
-
 
304
      chunkFilename: '[id].css'
-
 
305
    })
-
 
306
  ],
-
 
307
  optimization: {
-
 
308
    minimizer: [
-
 
309
      new TerserPlugin({
-
 
310
        extractComments: false
-
 
311
      })
-
 
312
    ]
-
 
313
  }
-
 
314
  /*
-
 
315
  plugins: [
73
  plugins: [
316
    new MiniCssExtractPlugin({
74
    new MiniCssExtractPlugin({
317
      filename: "[name].css",
75
      filename: "[name].css",
318
      chunkFilename: "[id].css",
-
 
319
    }),
76
      chunkFilename: "[id].css",
320
    new BundleAnalyzerPlugin({analyzerMode: 'server'})
77
    }),
321
  ],
78
  ],
322
  optimization: {
79
  optimization: {
323
    minimizer: [
80
    minimizer: [
324
      new TerserPlugin({
81
      new TerserPlugin({
325
        extractComments: false,
82
        extractComments: false,
326
      }),
83
      }),
327
    ],
84
    ],