Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 5072 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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