quackscape/webpack.config.js
Kumi bcca11aab9
refactor(js): streamline frontend SCSS import
Migrated the SCSS import for the frontend directly into editor.js and
userarea.js from frontend.js, removing redundancy by consolidating style
imports. This adjustment enables more coherent management of SCSS files
and removes the need for a separate frontend bundle. Consequently,
frontend.js and its references in HTML templates were removed to clean
up the codebase and simplify the asset pipeline. These changes should
make future maintenance of CSS easier and improve load times by reducing
unnecessary scripting and network requests.
2024-03-15 15:06:15 +01:00

62 lines
1.5 KiB
JavaScript

const path = require("path");
const miniCssExtractPlugin = require("mini-css-extract-plugin");
const autoprefixer = require('autoprefixer');
module.exports = {
entry: {
api: "./assets/js/api.js",
scene: "./assets/js/scene.js",
editor: "./assets/js/editor.js",
userarea: "./assets/js/userarea.js",
},
output: {
path: path.resolve(__dirname, "static/js"),
filename: "[name].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",
},
{
// Loader for webpack to process CSS with PostCSS
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [autoprefixer],
},
},
},
{
// Loads a SASS/SCSS file and compiles it to CSS
loader: "sass-loader",
},
],
},
],
},
};