Code Monkey home page Code Monkey logo

webpack-simplified's Introduction

webpcack simplified
---------------
Simple webpack config and structure, nothing fancy!

Webpack is an awesome tool, I make the use of it on a regular basis in my web projects.

From helping in code-splitting to applying various other optimizations on build time, it's awesome!

This is a simple webpcack structure that I usually follow ( might change ), I like it, it's simple and gives
you flexibility.

It does not contain too much, plugins can be added and removed, I have focused more on the configuration and the structure.

Contents:
---------
It contains a webpack.config.js file which it present at the root of the project. This file is the entry point and responsible for creating
the final webpack config on the basis of the given env and presets.

build-utils dir contains all the code build related stuff, which is mainly webpack related stuff.
It contains:
    webpack.development.js ( webpack --env.mode development)
    webpack.production.js ( webpack --env.mode production )

So if you do:  `npm run build:dev` , make use of webpack.development.js
and same for `npm run build:prod`, make use of webpack.production.js

It also contains : loadPresets.js file, which is responsible for loading the presets you need.
It loads the presets from the `presets` dir present inside `build-utils` dir.

So for example, if you wanna analyze the modules in your project, simply add the `webpack.analyze.js` (with the webpack bundle analyzer plugin inside the file) inside `presets` dir,
and it will load from there given that you include it in the script like: `--presets analyze,

similarly for compress, add `webpack.compress.js` in `presets` dir, and it will be loaded from there using `--presets compress`.

So, `webpack --env.mode production --presets compress`, will apply compress preset in prod env.

You can also apply multiple presets at once like: `webpack --env.mode production --presets compress --presets analyze`

Check the `package.json` files for the used scripts.



webpack-simplified's People

Contributors

abhishekg785 avatar

Watchers

James Cloos avatar  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.