ماذا عن استيراد ملفات fonts, images
وأيضا إضافة خصائص module وال plugins الموجودة في ملف webpack.config.js ونقلها الى vite.config.js
module: {
rules: [
{
test: /\.html$/i,
loader: "html-loader",
options: {
minimize: true,
},
},
{
test: /\.(sa|sc|c)ss$/,
exclude: /custom\.scss$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
esModule: false,
},
}
,
"css-loader",
"sass-loader"],
},
{
test: /custom\.scss$/i,
use: [
{
loader: MiniCssExtractPlugin.loader,
options: {
esModule: false,
},
},
'rtlcss-loader',
'sass-loader'
]
},
{
test: /\.(png|svg|jpg|jpeg|gif)$/i,
type: 'asset/resource',
generator: {
filename: "./images/[name][ext]"
}
},
{
test: /\.(svg|eot|woff|woff2|ttf)$/i,
type: 'asset/resource',
generator: {
filename: "./fonts/[name][ext]"
}
},
],
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: "./src/index.html"
}),
new HtmlWebpackPlugin({
filename: "product.html",
template: "./src/product.html"
}),
new HtmlWebpackPlugin({
filename: "payment.html",
template: "./src/payment.html"
}),
new HtmlWebpackPlugin({
filename: "checkout.html",
template: "./src/checkout.html"
}),
new HtmlWebpackPlugin({
filename: "search.html",
template: "./src/search.html"
}),
new HtmlWebpackPlugin({
filename: "contact.html",
template: "./src/contact.html"
}),
new MiniCssExtractPlugin({
filename: "css/style.css"
}),
new CssMinimizerPlugin()
]
};