Skip to content

WebPack Template includes configurations of Linters and webpack in correct manner to avoid uncertain errors in future.

Notifications You must be signed in to change notification settings

MasumaJaffery/WebPack

Repository files navigation

WebPack Configurations

Pre-requisites

Configure Linters in main Branch.

Step 1 (Files):

Create Three Files inside src folder that must be inside repo folder;

  1. index.html
  2. style.css
  3. index.js

Step 2 (Create WebPack File)

Create an webpack.config.js file inside repo folder.

 const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
  mode: 'development',
  entry: {
    index: './src/index.js',
  },
  plugins: [
    new HtmlWebpackPlugin({
      template: './src/index.html',
    }),
  ],
  output: {
    filename: '[name].bundle.js',
    path: path.resolve(__dirname, 'dist'),
    clean: true,
  },
  module: {
    rules: [
      {
        test: /\.css$/i,
        use: ['style-loader', 'css-loader'],
      },
    ],
  },
};

Step 3 (Install WebPack):

 npm install webpack webpack-cli --save-dev

Step 4 (Install style-loader and css-loader):

npm install --save-dev style-loader css-loader

Step 5 (Install HtmlWebpackPlugin plugin):

npm install --save-dev html-webpack-plugin

Step 6 (Install Webpack-dev-server):

npm install --save-dev webpack-dev-server

Step 8 (Make Changes in package.json file):

Update scripts part of package.json with these lines!

"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack serve --open",
"build": "webpack"

Step 9 (Run Following Command to Generate .dist/ folder):

npm run build

Step 10 (Run Following Command to Run Project by WebPack Server):

npm start

Setup

Clone this repository to your desired folder:

👥 Authors

👤 Syeda Masuma Fatima

(back to top)

🙏 Acknowledgments

Give credit to everyone who inspired your codebase.

I would like to thank Microverse!

📝 License

This project is MIT licensed.

NOTE: we recommend using the MIT license - you can set it up quickly by using templates available on GitHub. You can also use any other license if you wish.

(back to top)

About

WebPack Template includes configurations of Linters and webpack in correct manner to avoid uncertain errors in future.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published