Coder Social home page Coder Social logo

build-tools-bucheli-course-webpack-project-setup's Introduction

BUILD-TOOLS-BUCHELI-COURSE-WEBPACK-PROJECT-SETUP

In order to set up webpack in a project, follow the next steps:

  • npm init -y (Webpack is a Node package. To use Node packages, we need a package.json which holds important project metadata about any Node project. We can initialize a Node project using npm init in the terminal to make a package.json file. We can use the -y flag to use the default values for the metadata fields).

  • npm install --save-dev webpack webpack-cli (We need two packages, webpack and webpack-cli, to build our Webpack project with the command line. webpack contains the main functionality, but webpack-cli allows command-line access to Webpack. We want these tools to be developer dependencies because they will not be used when the final product is running. We use npm install and the --save-dev flag to save packages as developer dependencies).

  • A Webpack project requires an entry point where it will find the main file to bundle. Webpack will throw a long error indicating a problem with main if there are no files at the entry point. The default Webpack entry point is index.js in a src folder, although this can be changed. If we want to use the default entry point, we should make an src folder with an index.js inside of it.

  • A build command is often defined in the scripts section of package.json for running Webpack. You can find more information on the scripts section here. Using a build command makes the way we build the project independent of what build tools we use. We define the build command like so:A build command is often defined in the scripts section of package.json for running Webpack. You can find more information on the scripts section here. Using a build command makes the way we build the project independent of what build tools we use. We define the build command like so:

"scripts": {
  "build": "webpack --watch",
},
  • npm run build

build-tools-bucheli-course-webpack-project-setup's People

Contributors

arbucheli avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.