Skip to content

Webpack

Ihar Aliakseyeu edited this page Dec 2, 2022 · 1 revision
  1. If the project is not yet using NPM, then initialize it (-y for standard configuration):
    npm init -y
  2. Install webpack locally, and install the webpack-cli the tool used to run webpack on the command line:
    npm install webpack webpack-cli --save-dev
    If you haven't used NPM before, after installation, a node_modules folder with modules will be created.
  3. Create a config file webpack.config.js
module.exports = {
  entry: './dev-main.js',
  mode: 'development',
  module: {
    rules: [],
  },
};
  1. Install sass-loader
    npm install sass-loader sass webpack --save-dev
  2. Add into rules:[] in config webpack.config.js file
{
test: /\.s[ac]ss$/i,
use: [
 // Creates `style` nodes from JS strings
 "style-loader",
 // Translates CSS into CommonJS
 "css-loader",
 // Compiles Sass to CSS
 "sass-loader",
 ],

test SideBar

Clone this wiki locally