Created
October 9, 2023 15:14
-
-
Save laurisstepanovs/17707055c733195028d02180045a8fa7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* eslint-disable no-undef */ | |
| const path = require("path"); | |
| const WebpackRTLPlugin = require("webpack-rtl-plugin"); | |
| const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |
| const RemovePlugin = require("remove-files-webpack-plugin"); | |
| // global variables | |
| // eslint-disable-next-line no-undef | |
| const distPath = `${path.resolve(__dirname)}/src/assets/rtl`; | |
| const entries = { style: "./src/assets/sass/style.scss" }; | |
| module.exports = { | |
| entry: entries, | |
| output: { | |
| // main output path in assets folder | |
| path: distPath, | |
| // output path based on the entries filename | |
| filename: "[name].js", | |
| // clean existing output folder | |
| clean: true, | |
| }, | |
| resolve: { | |
| extensions: [".scss"], | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.scss$/, | |
| use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"], | |
| }, | |
| ], | |
| }, | |
| plugins: [ | |
| new MiniCssExtractPlugin({ | |
| filename: "[name].css", | |
| }), | |
| new WebpackRTLPlugin(), | |
| new RemovePlugin({ | |
| // delete uneeded files from webpack output | |
| after: { | |
| root: distPath, | |
| include: ["style.js", "style.css"], | |
| trash: true, | |
| }, | |
| }), | |
| ], | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment