|
|
|
const path = require('path')
|
|
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
|
|
const CopyPlugin = require('copy-webpack-plugin')
|
|
|
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin')
|
|
|
|
const date = new Date()
|
|
|
|
const tanggal = `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
|
|
|
|
//__dirname,
|
|
|
|
module.exports = {
|
|
|
|
ignoreWarnings: [
|
|
|
|
{
|
|
|
|
module: /module2\.js\?[34]/ // A RegExp
|
|
|
|
},
|
|
|
|
{
|
|
|
|
module: /[13]/,
|
|
|
|
message: /homepage/
|
|
|
|
},
|
|
|
|
/warning from compiler/,
|
|
|
|
(warning) => true
|
|
|
|
],
|
|
|
|
|
|
|
|
entry: {
|
|
|
|
kpdl: './app/Views/kewilayahan/kytp/kpdl.js',
|
|
|
|
monitoring: './app/Views/kewilayahan/monitoring/index.js',
|
|
|
|
peta: './app/Views/kewilayahan/peta/peta.js'
|
|
|
|
},
|
|
|
|
output: {
|
|
|
|
path: path.resolve('./app/Views/kewilayahan/dist'),
|
|
|
|
filename: '[name].js'
|
|
|
|
},
|
|
|
|
// optimization: {
|
|
|
|
// minimize: true
|
|
|
|
// },
|
|
|
|
optimization: {
|
|
|
|
minimizer: [
|
|
|
|
// For webpack@5 you can use the `...` syntax to extend existing minimizers (i.e. `terser-webpack-plugin`), uncomment the next line
|
|
|
|
`...`,
|
|
|
|
new CssMinimizerPlugin()
|
|
|
|
]
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
rules: [
|
|
|
|
{
|
|
|
|
exclude: /node_modules/,
|
|
|
|
use: {
|
|
|
|
loader: 'babel-loader',
|
|
|
|
options: {
|
|
|
|
presets: ['@babel/preset-react'],
|
|
|
|
plugins: ['@babel/plugin-proposal-optional-chaining', '@babel/plugin-proposal-nullish-coalescing-operator']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.s[ac]ss$/i,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
publicPath: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'css-loader',
|
|
|
|
'sass-loader'
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /\.css$/i,
|
|
|
|
// use: ['style-loader', 'css-loader']
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: MiniCssExtractPlugin.loader,
|
|
|
|
options: {
|
|
|
|
publicPath: ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
loader: 'css-loader',
|
|
|
|
options: {
|
|
|
|
url: {
|
|
|
|
filter: (url) => {
|
|
|
|
if (/^data:(application\/font-woff|image|font)/i.test(url)) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
test: /Image\.(png|jpe?g|gif)$/i,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: 'file-loader'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
mode: 'production',
|
|
|
|
plugins: [
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: '[name].css',
|
|
|
|
chunkFilename: '[id].css'
|
|
|
|
}),
|
|
|
|
new CopyPlugin({
|
|
|
|
patterns: [
|
|
|
|
{
|
|
|
|
from: './package.json',
|
|
|
|
to: path.resolve('.') + path.join('/release-update/', tanggal, '[name][ext]'),
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: './app/Views/kewilayahan/dist/*.*',
|
|
|
|
to: path.resolve('./public/kpdl/dist/[name][ext]'),
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: './app/Views/kewilayahan/dist',
|
|
|
|
to({ context, absoluteFilename }) {
|
|
|
|
return `${path.resolve('.') + path.join('/release-update', tanggal, '/public/kpdl/dist/')}${path.relative(context, absoluteFilename)}`
|
|
|
|
},
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: './app/Views/kewilayahan',
|
|
|
|
to({ context, absoluteFilename }) {
|
|
|
|
return `${path.resolve('.') + path.join('/release-update', tanggal, '/app/Views/kewilayahan/')}${path.relative(context, absoluteFilename)}`
|
|
|
|
},
|
|
|
|
info: { minimized: true },
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: './app/Controllers/Kewilayahan',
|
|
|
|
to({ context, absoluteFilename }) {
|
|
|
|
return `${path.resolve('.') + path.join('/release-update', tanggal, '/app/Controllers/Kewilayahan/')}${path.relative(context, absoluteFilename)}`
|
|
|
|
},
|
|
|
|
info: { minimized: true },
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: './app/Helpers/KpdlHelper_helper.php',
|
|
|
|
to({ context, absoluteFilename }) {
|
|
|
|
return `${path.resolve('.') + path.join('/release-update', tanggal, '/app/Helpers/')}${path.relative(context, absoluteFilename)}`
|
|
|
|
},
|
|
|
|
info: { minimized: true },
|
|
|
|
force: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
from: './app/Libraries/KpdlLibrary.php',
|
|
|
|
to({ context, absoluteFilename }) {
|
|
|
|
return `${path.resolve('.') + path.join('/release-update', tanggal, '/app/Libraries/')}${path.relative(context, absoluteFilename)}`
|
|
|
|
},
|
|
|
|
info: { minimized: true },
|
|
|
|
force: true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
})
|
|
|
|
]
|
|
|
|
}
|