Answer the question
In order to leave comments, you need to log in
How to make webpack rename classes in html?
Now it only renames to css.
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const Webpack = require('webpack');
module.exports = {
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'main.js',
publicPath: '',
},
mode: 'development',
devServer: {
contentBase: path.resolve(__dirname, './dist'),
open: true,
compress: true,
port: 8080
},
module: {
rules: [{
test: /\.js$/,
use: 'babel-loader',
exclude: '/node_modules/'
},
{
test: /\.(png|svg|jpg|gif|woff(2)?|eot|ttf|otf)$/,
type: 'asset/resource',
},
{
test: /\.css$/,
use: [MiniCssExtractPlugin.loader, {
loader: 'css-loader',
options: {
importLoaders: 1,
modules: true
}
},
'postcss-loader'
]
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/pages/index.html',
filename: 'index.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/vacancies.html',
filename: 'vacancies.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/vacancy.html',
filename: 'vacancy.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/contact.html',
filename: 'contact.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/404.html',
filename: '404.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/about.html',
filename: 'about.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/projects.html',
filename: 'projects.html'
}),
new HtmlWebpackPlugin({
template: './src/pages/simple-page.html',
filename: 'simple-page.html'
}),
new CleanWebpackPlugin(),
new MiniCssExtractPlugin(),
new Webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}),
]
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question