All Projects → jaredpalmer → Backpack

jaredpalmer / Backpack

Licence: mit
🎒 Backpack is a minimalistic build system for Node.js projects.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Backpack

Mhy
🧩 A zero-config, out-of-the-box, multi-purpose toolbox and development environment
Stars: ✭ 128 (-97.13%)
Mutual labels:  webpack, build, babel
Woo Next
🚀 React WooCommerce theme, built with Next JS, Webpack, Babel, Node, Express, using GraphQL and Apollo Client
Stars: ✭ 342 (-92.34%)
Mutual labels:  webpack, babel
Gulp Scss Starter
Frontend development with pleasure. SCSS version
Stars: ✭ 339 (-92.41%)
Mutual labels:  webpack, babel
Js Library Boilerplate Basic
Javascript Minimal Starter Boilerplate - Webpack 5 🚀, Babel 7, UMD, Unit Testing
Stars: ✭ 354 (-92.07%)
Mutual labels:  webpack, babel
Wp Webpack Script
💥🔥📦👩‍💻 An easy to use, pre configured, hackable webpack setup & development server for WordPress themes and plugins.
Stars: ✭ 314 (-92.97%)
Mutual labels:  webpack, babel
Instapy Gui
gui for instapy automation
Stars: ✭ 313 (-92.99%)
Mutual labels:  webpack, babel
Pwa
An opinionated progressive web app boilerplate
Stars: ✭ 353 (-92.1%)
Mutual labels:  webpack, babel
Generator Webappstarter
Quick start a web app for mobile.Automatically adjusts according to a device’s screen size without any extra work.
Stars: ✭ 298 (-93.33%)
Mutual labels:  webpack, babel
Webbf
Java Web工程demo 后端:spring + spring mvc + mybatis + maven,涉及定时任务quartz、ehcache缓存、RESTful API、邮件发送... 前端:react + reflux + webpack,涉及ES6、jquery、react-router、ant design等内容, 提供下思路,仅供参考。
Stars: ✭ 367 (-91.78%)
Mutual labels:  webpack, babel
Sku
Front-end development toolkit
Stars: ✭ 403 (-90.98%)
Mutual labels:  webpack, babel
Webpack Boilerplate
A minimal webpack 5 boilerplate with only Babel, SASS and lodash (optional) on board
Stars: ✭ 404 (-90.95%)
Mutual labels:  webpack, babel
Support
JS.coach is a manually curated list of packages related to React, Webpack, Babel and PostCSS
Stars: ✭ 305 (-93.17%)
Mutual labels:  webpack, babel
Seek Style Guide
Living style guide for SEEK, powered by React, webpack, CSS Modules and Less.
Stars: ✭ 302 (-93.24%)
Mutual labels:  webpack, babel
Electron React Boilerplate
A Foundation for Scalable Cross-Platform Apps
Stars: ✭ 18,727 (+319.32%)
Mutual labels:  webpack, babel
React Bolt
⚡ The most simple & robust boilerplate for your React projects.
Stars: ✭ 298 (-93.33%)
Mutual labels:  webpack, babel
Server Side Rendering
Interactive guide to server-side rendering with Webpack, React, React Transmit, CSS modules and more
Stars: ✭ 352 (-92.12%)
Mutual labels:  webpack, babel
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (-89.72%)
Mutual labels:  webpack, babel
React Redux Sass Starter
Everything you need to get started with a basic React application
Stars: ✭ 293 (-93.44%)
Mutual labels:  webpack, babel
React Pwa Guide App
React.js for Progressive Web Apps that say Hello! World
Stars: ✭ 293 (-93.44%)
Mutual labels:  webpack, babel
Wxapp Boilerplate
使用 webpack, babel, scss 开发的微信/支付宝小程序项目脚手架
Stars: ✭ 367 (-91.78%)
Mutual labels:  webpack, babel

backpack

backpack-status npm version Discord

Backpack is minimalistic build system for Node.js. Inspired by Facebook's create-react-app, Zeit's Next.js, and Remy's Nodemon, Backpack lets you create modern Node.js apps and services with zero configuration. Backpack handles all the file-watching, live-reloading, transpiling, and bundling, so you don't have to. It comes with a few conventions defaults (like support for the latest JavaScript awesomeness (i.e. async/await, object rest spread, and class properties)), but everything can be customized to fit your project's needs. Best of all, you can easily add Backpack to your existing Node.js project with just a single dependency.

Backpack comes with the "battery-pack included":

  • Latest ES6 features (including module syntax, async/await, object rest spread)
  • SUPER friendly, human readable error messages
  • Live reload (on saves, add/delete file, etc.)
  • Zero-config, one dependency.

HOWEVER, you can configure Backpack to your project's needs by extending the underlying Webpack 4 configuration.

PLEASE READ: If you're thinking of using Backpack with React.js, you should use Razzle instead. It is a project purpose-built for SSR React with an almost identical API.

Table of Contents

How to use

Install it:

npm i backpack-core --save

and add a script to your package.json like this:

{
  "scripts": {
    "dev": "backpack"
  }
}

After that there are just a few conventions defaults:

  • src/index.js: the entry of your app.

...actually that's it.

You can then run your application in development mode:

npm run dev

Successful builds will show a console like this. Note: screenshot taken from running the basic example npm run dev

Custom configuration

For custom advanced behavior, you can create a backpack.config.js in the root of your project's directory (next to package.json).

// backpack.config.js
// IMPORTANT: This file is not going through babel transformation.
// You can however use the ES2015 features supported by your Node.js version.
module.exports = {
  /* config options here */
};

Customizing webpack config

Example

To extend webpack, you can define a function that extends its config via backpack.config.js.

// backpack.config.js
module.exports = {
  webpack: (config, options, webpack) => {
    // Perform customizations to config
    // Important: return the modified config
    return config;
  },
};

Customizing babel config

Example

To extend our usage of babel, you can define a .babelrc file at the root of your app. This file is optional.

If found, Backpack will consider it to be the source of truth. Thus it must define what Backpack needs as well, which is the backpack-core/babel preset.

This is designed so that you are not surprised by modifications we could make to the default babel configurations.

Here's an example .babelrc file:

{
  "presets": [
    "backpack-core/babel",
    "stage-0"
  ]
}

Note: This works exactly like Next.js does.

Building for Production

Add a npm script for the build step:

{
  "scripts": {
    "dev": "backpack",
    "build": "backpack build"
  }
}

Then run the build command and start your app

npm run build
node ./build/main.js

CLI Commands

backpack dev

Runs backpack in development mode.

Your code will reload if you make edits.
You will see the build errors in the console that look like this.

backpack dev

backpack build

Builds the app for production to the build folder.
It correctly bundles your production mode and optimizes the build for the best performance.

You can run your production application with the following command:

node ./build/main.js

Your application is ready to be deployed!

Note: Make sure to add the build directory to your .gitignore to keep compiled code out of your git repository

FAQ

Is this like Create-React-App or Next.js?

Yes and No.

Yes in that they will all make your life easier.

No in that it that Backpack is focused on server-only applications. You should use create-react-app or Next.js for your frontend and then build your backend with Backpack.

Can I use this with React to build a universal app?

Technically, yes. However, we strongly advise against it at the moment. Backpack handles file-watching and reloading in a way that will make things like webpack-hot-middleware annoying to work with.

What syntactic features are transpiled? How do I change them?

We track V8. Since V8 has wide support for ES6, we don't transpile it. Since V8 doesn’t support async/await and class properties yet, we transpile those.

See this and this

Why is it called Backpack?

Backpack is focused on server-only applications. We've been using it for building out Node.js backends and microservices. Under the hood, Webpack and a few other tools make the magic happen. Hence Backend + Webpack = Backpack.

Inspiration

Authors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].