-
Notifications
You must be signed in to change notification settings - Fork 1
Webpack
Ihar Aliakseyeu edited this page Dec 2, 2022
·
1 revision
- If the project is not yet using NPM, then initialize it (
-yfor standard configuration):
npm init -y - 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. - Create a config file webpack.config.js
module.exports = {
entry: './dev-main.js',
mode: 'development',
module: {
rules: [],
},
};
- Install sass-loader
npm install sass-loader sass webpack --save-dev - 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",
],