Skip to content

Commit

Permalink
Updated webpack config for version 5
Browse files Browse the repository at this point in the history
  • Loading branch information
kcaran authored and nodiscc committed Oct 19, 2024
1 parent 3c11bc1 commit 47fd4df
Showing 1 changed file with 23 additions and 35 deletions.
58 changes: 23 additions & 35 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const TerserPlugin = require('terser-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

const extractCss = new MiniCssExtractPlugin({
filename: "../css/[name].min.css",
filename: "css/[name].min.css",
});

module.exports = [
Expand All @@ -30,8 +30,8 @@ module.exports = [
markdown: './assets/common/css/markdown.css',
},
output: {
filename: '[name].min.js',
path: path.resolve(__dirname, 'tpl/default/js/')
filename: 'js/[name].min.js',
path: path.resolve(__dirname, 'tpl/default/')
},
module: {
rules: [
Expand All @@ -52,33 +52,30 @@ module.exports = [
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: 'tpl/default/css/',
},
},
'css-loader',
'sass-loader',
],
},
{
test: /\.(gif|png|jpe?g|svg|ico)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '../img/[name].[ext]',
publicPath: 'tpl/default/img/',
}
}
],
type: 'asset/resource',
generator: {
filename: 'img/[name][ext]'
}
},
{
test: /webfont\.svg$/,
type: 'asset/resource',
generator: {
filename: 'fonts/[name][ext]'
}
},
{
test: /\.(eot|ttf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
options: {
name: '../fonts/[name].[ext]',
// do not add a publicPath here because it's already handled by CSS's publicPath
publicPath: '../default/',
type: 'asset/resource',
generator: {
filename: 'fonts/[name][ext]'
}
},
],
Expand All @@ -105,8 +102,8 @@ module.exports = [
thumbnails_update: './assets/common/js/thumbnails-update.js',
},
output: {
filename: '[name].min.js',
path: path.resolve(__dirname, 'tpl/vintage/js/')
filename: 'js/[name].min.js',
path: path.resolve(__dirname, 'tpl/vintage/')
},
module: {
rules: [
Expand All @@ -127,26 +124,17 @@ module.exports = [
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
publicPath: 'tpl/vintage/css/',
},
},
'css-loader',
'sass-loader',
],
},
{
test: /\.(gif|png|jpe?g|svg|ico)$/i,
use: [
{
loader: 'file-loader',
options: {
name: '../img/[name].[ext]',
// do not add a publicPath here because it's already handled by CSS's publicPath
publicPath: '../vintage',
}
}
],
type: 'asset/resource',
generator: {
filename: 'img/[name][ext]'
}
},
],
},
Expand Down

0 comments on commit 47fd4df

Please sign in to comment.