Rev 15178 | Rev 15192 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
const path = require('path')
const isDevelopment = process.env.NODE_ENV === 'development'
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const TerserPlugin = require('terser-webpack-plugin')
// Add paths while bundling
const paths = {
menu: {
entry: './react-webpack/menu/index.js',
output: path.join(__dirname, 'public/react-bundles/menu'),
filename: 'menuBundle.js',
},
companySizes: {
entry: './react-webpack/settings/company-sizes/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/company-sizes'),
filename: 'companySizesBundle.js',
},
competencyTypes: {
entry: './react-webpack/settings/competency-types/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/competency-types'),
filename: 'competencyTypesBundle.js',
},
groupTypes: {
entry: './react-webpack/settings/groups-types/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/group-types'),
filename: 'groupTypesBundle.js',
},
industries: {
entry: './react-webpack/settings/industries/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/industries'),
filename: 'industriesBundle.js',
},
skills: {
entry: './react-webpack/settings/skills/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/skills'),
filename: 'skillsBundle.js',
},
degrees: {
entry: './react-webpack/settings/degrees/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/degrees'),
filename: 'degreesBundle.js',
},
categories: {
entry: './react-webpack/settings/job-categories/index.js',
output: path.join(__dirname, 'public/react-bundles/settings/job-categories'),
filename: 'jobCategoriesBundle.js',
},
profile: {
entry: './react-webpack/profile/index.js',
output: path.join(__dirname, 'public/react-bundles/profile'),
filename: 'profileBundle.js',
},
jobs: {
entry: './react-webpack/jobs/index.js',
output: path.join(__dirname, 'public/react-bundles/jobs'),
filename: 'jobsBundle.js',
},
feeds: {
entry: './react-webpack/feeds/index.js',
output: path.join(__dirname, 'public/react-bundles/feeds'),
filename: 'feedsBundle.js',
},
followers: {
entry: './react-webpack/follower/index.js',
output: path.join(__dirname, 'public/react-bundles/followers'),
filename: 'followersBundle.js',
},
recruitment_and_selection_vacancies: {
entry: './react-webpack/recruitment_and_selection/vacancies/index.js',
output: path.join(__dirname, 'public/react-bundles/recruitment_and_selection/vacancies'),
filename: 'vacanciesBundle.js',
},
recruitment_and_selection_candidates: {
entry: './react-webpack/recruitment_and_selection/candidates/index.js',
output: path.join(__dirname, 'public/react-bundles/recruitment_and_selection/candidates'),
filename: 'candidatesBundle.js',
},
recruitment_and_selection_interviews: {
entry: './react-webpack/recruitment_and_selection/interviews/index.js',
output: path.join(__dirname, 'public/react-bundles/recruitment_and_selection/interviews'),
filename: 'interviewsBundle.js',
},
chat: {
entry: './react-webpack/chat/index.js',
output: path.join(__dirname, 'public/react-bundles/chat'),
filename: 'chatBundle.js',
},
mobileChat: {
entry: './react-webpack/mobile-chat/index.js',
output: path.join(__dirname, 'public/react-bundles/mobileChat'),
filename: 'mobileChatBundle.js',
},
objetives_and_goals_planing: {
objetives: {
entry: './react-webpack/objetives_and_goals-planing/objetives/index.js',
output: path.join(__dirname, 'public/react-bundles/objetives_and_goals-planing/objetives'),
filename: 'objetivesBundle.js',
},
goals: {
entry: './react-webpack/objetives_and_goals-planing/goals/index.js',
output: path.join(__dirname, 'public/react-bundles/objetives_and_goals-planing/goals'),
filename: 'goalsBundle.js',
},
tasks: {
entry: './react-webpack/objetives_and_goals-planing/tasks/index.js',
output: path.join(__dirname, 'public/react-bundles/objetives_and_goals-planing/tasks'),
filename: 'tasksBundle.js',
}
},
performance_evaluations: {
forms: {
entry: './react-webpack/performance_evaluations/forms/index.js',
output: path.join(__dirname, 'public/react-bundles/performance_evaluations/forms'),
filename: 'formsBundle.js',
},
evaluations: {
entry: './react-webpack/performance_evaluations/evaluations/index.js',
output: path.join(__dirname, 'public/react-bundles/performance_evaluations/evaluations'),
filename: 'evaluationsBundle.js',
}
},
organizational_climate: {
forms: {
entry: './react-webpack/organizational-climate/form/index.js',
output: path.join(__dirname, 'public/react-bundles/organizational-climate/form'),
filename: 'organizationalFormBundle.js',
}
},
jobDescription: {
entry: './react-webpack/job_description/index.js',
output: path.join(__dirname, 'public/react-bundles/job_description'),
filename: 'jobDescription.js',
},
}
// change active path here
const currentPath = paths.profile
module.exports = {
entry: currentPath.entry,
output: {
path: currentPath.output,
filename: currentPath.filename,
},
watch: isDevelopment ? true : false,
mode: isDevelopment ? 'development' : 'production',
resolve: {
extensions: ['.js', '.jsx', '.scss'],
},
module: {
rules: [
{
test: /(js|jsx)$/,
use: ['babel-loader'],
exclude: /node_modules/,
},
{
test: /\.css$/i,
use: [MiniCssExtractPlugin.loader, 'css-loader'],
},
{
test: /\.module\.s(a|c)ss$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader',
options: {
modules: {
localIdentName: '[local]--[hash:base64:5]',
},
sourceMap: isDevelopment,
},
},
{
loader: 'sass-loader',
options: {
sourceMap: isDevelopment,
},
},
],
},
{
test: /\.s(a|c)ss$/,
exclude: /\.module.(s(a|c)ss)$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'sass-loader',
options: {
sourceMap: isDevelopment,
},
},
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css',
}),
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
}),
],
},
}