great-website/webpack.config.js
Kumi 3ab3a30884
feat(webpack): remove postcss-loader integration
Removed the integration of `postcss-loader` from the webpack
configuration to streamline the build process. This adjustment
simplifies CSS processing, relying on `sass-loader` for direct
compilation without the need for PostCSS plugins such as autoprefixer.
The decision enhances build performance and minimizes configuration
complexity, making the setup more straightforward for future maintenance
and updates. Potential impacts include the need for manual prefixing in
some cases, which should be considered during development.
2024-03-28 09:14:14 +01:00

48 lines
1.1 KiB
JavaScript

const path = require("path");
const miniCssExtractPlugin = require("mini-css-extract-plugin");
const autoprefixer = require('autoprefixer');
module.exports = {
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "lib"),
filename: "index.bundle.js",
},
plugins: [new miniCssExtractPlugin()],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"],
},
{
test: /\.scss$/,
use: [
{
// Adds CSS to the DOM by injecting a `<style>` tag
loader: "style-loader",
},
{
// Interprets `@import` and `url()` like `import/require()` and will resolve them
loader: "css-loader",
},
{
// Loads a SASS/SCSS file and compiles it to CSS
loader: "sass-loader",
},
],
},
],
},
};