import path from 'path'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import MiniCssExtractPlugin from 'mini-css-extract-plugin'; import { fileURLToPath } from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); export default { entry: './src/js/index.js', mode: 'development', devtool: 'inline-source-map', output: { filename: 'main.js', path: path.resolve(__dirname, 'target'), clean: true, }, plugins: [ new HtmlWebpackPlugin({ title: 'Mediaplayer', template: './src/html/index.html' }), new MiniCssExtractPlugin(), ], module: { rules: [ { test: /\.css$/i, oneOf: [ { assert: { type: "css" }, loader: "css-loader", options: { exportType: "css-style-sheet", } }, { assert: { type: "text" }, loader: "css-loader", options: { exportType: "string", } }, { use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader"] }, ] }, { test: /\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i, type: "asset", }, { test: /\.html$/i, loader: "html-loader", }, ], }, };