Fix webpack

This commit is contained in:
Eduard Ursu 2024-02-21 20:57:45 +01:00
parent f24186ff0e
commit 2dd83f51e0
3 changed files with 12 additions and 10 deletions

View file

@ -6,11 +6,13 @@ module.exports = merge(main, {
mode: 'development',
devServer: {
static: {
directory: config.dist
directory: config.dist,
publicPath: '/'
},
compress: true,
port: 3000,
hot: true,
open: true
open: '/toolz/',
historyApiFallback: true
}
})

View file

@ -3,6 +3,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const config = require('./config')
const pages = config.pages
module.exports = {
context: config.src,
entry: {
@ -12,10 +13,11 @@ module.exports = {
}, {})
},
output: {
filename: './js/[name].js',
filename: 'js/[name].js',
path: config.build,
clean: false,
assetModuleFilename: '[path][name][ext]'
assetModuleFilename: '[path][name][ext]',
publicPath: '/toolz/'
},
plugins: [
new CopyWebpackPlugin({
@ -36,7 +38,7 @@ module.exports = {
]
}),
new MiniCssExtractPlugin({
filename: './css/[name].css',
filename: 'css/[name].css',
chunkFilename: '[name].css'
}),
...pages.map(
@ -60,7 +62,6 @@ module.exports = {
test: /\.ejs$/i,
use: ['html-loader', 'template-ejs-loader']
},
{
test: /\.js$/,
exclude: /node_modules/,
@ -69,9 +70,9 @@ module.exports = {
{
test: /\.(sa|sc|c)ss$/,
use: [
MiniCssExtractPlugin.loader, // extract css from commonjs
'css-loader', // turn css into commonjs
'sass-loader' // turn scss into css
MiniCssExtractPlugin.loader, // Extract CSS from commonjs
'css-loader', // Turn css into commonjs
'sass-loader' // Turn scss into css
]
}
]

View file

@ -5,7 +5,6 @@ const TerserPlugin = require('terser-webpack-plugin')
module.exports = merge(main, {
mode: 'production',
publicPath: '/toolz/',
optimization: {
minimize: true,
minimizer: [