Rev 3694 | AutorÃa | Ultima modificación | Ver Log |
import path from 'path';
import isDevelopment from 'process';
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import TerserPlugin from 'terser-webpack-plugin';
// import BundleAnalyzerPlugin from 'webpack-bundle-analyzer';
const currentDirname = path.resolve();
export default {
entry: './app/index.jsx',
output: {
path: path.join(path.resolve(), 'public/bundles'),
filename: 'applicationBundle.js'
},
watch: false,
mode: 'production',
resolve: {
alias: {
ckeditor5: path.resolve(currentDirname, 'node_modules/ckeditor5/dist/ckeditor5.js'),
'ckeditor5.css': path.resolve(currentDirname, 'node_modules/ckeditor5/dist/ckeditor5.css'),
'@components': path.resolve(currentDirname, 'app/components/'),
'@constants': path.resolve(currentDirname, 'app/constants/'),
'@hocs': path.resolve(currentDirname, 'app/hocs/index.js'),
'@hooks': path.resolve(currentDirname, 'app/hooks/index.js'),
'@layouts': path.resolve(currentDirname, 'app/layouts/'),
'@pages': path.resolve(currentDirname, 'app/pages/'),
'@providers': path.resolve(currentDirname, 'app/providers/'),
'@store': path.resolve(currentDirname, 'app/redux/'),
'@styles': path.resolve(currentDirname, 'app/styles/'),
'@services': path.resolve(currentDirname, 'app/services/'),
'@utils': path.resolve(currentDirname, 'app/utils/'),
'@shared': path.resolve(currentDirname, 'app/modules/shared/'),
'@api': path.resolve(currentDirname, 'app/modules/shared/libs/axios.js'),
'@microlearning': path.resolve(currentDirname, 'app/modules/microlearning/'),
'@knowledges': path.resolve(currentDirname, 'app/modules/knowledges/'),
'@marketplace': path.resolve(currentDirname, 'app/modules/marketplace/'),
'@inmail': path.resolve(currentDirname, 'app/modules/inmail/'),
'@groups': path.resolve(currentDirname, 'app/modules/groups/'),
'@app': path.resolve(currentDirname, 'app/'),
store: path.resolve(currentDirname, 'app/redux/'),
components: path.resolve(currentDirname, 'app/components/'),
utils: path.resolve(currentDirname, 'app/utils/')
},
extensions: ['.js', '.jsx', '.scss', '.css']
},
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
}
}
]
},
{
test: /\.s(a|c)ss$/,
exclude: /\.module.(s(a|c)ss)$/,
use: [MiniCssExtractPlugin.loader, 'css-loader']
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: '[name].css',
chunkFilename: '[id].css'
})
],
optimization: {
minimizer: [new TerserPlugin({ extractComments: false })]
}
};