Code Monkey home page Code Monkey logo

webpack-for-any-projects's Introduction

Prerequisites

You will need NodeJS, then install Yarn globally

npm install - g yarn

Setting up

Create package.json by running this command

yarn init

Initial Configuration

Add Webpack

yarn add webpack webpack-dev-server html-webpack-plugin -D

Add Babel-loader (Allow us to use ES2015+ in our code)

yarn add babel-core babel-loader babel-preset-env -D

Add sass-loader (Allow us to use scss styling)

yarn add raw-loader sass-loader node-sass css-loader style-loader -D

Add extract-text-webpack-plugin (Extracts text from a bundle, or bundles, into a separate file)

yarn add extract-text-webpack-plugin -D

Add DefinePlugin to create global constants

yarn add dotenv -D

Add webpack-dashboar for webpack-dev-server

yarn add webpack-dashboard -D

Control Development Environments

yarn add copy-webpack-plugin uglifyjs-webpack-plugin -D

Project Structure

  • src: Main project container.
  • src/app: Will host our javacript files.
  • src/public: Holds project assets and static files.
  • src/style: Holds the project's global styles.
  • src/app/index.js: Main entry point into our project.
  • src/public/index.html: Main project template.

Start Project

yarn start

Errors

If you encounter this error: 'webpack-dev-server not recognized' please run

npm install --only=dev

This git follows instructions from Scotch.io

webpack-for-any-projects's People

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.