
Security News
pnpm 10.16 Adds New Setting for Delayed Dependency Updates
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
@paulxuca/backpack-core
Advanced tools
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":
HOWEVER, you can configure Backpack to your project's needs by extending the underlying Webpack 2 configuration.
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
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 */
};
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;
},
};
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",
"stage-0"
],
}
Note: This works exactly like Next.js does.
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
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 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
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.
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.
We track V8. Since V8 has wide support for ES6 and async and await, we transpile those. Since V8 doesn’t support class decorators, we don’t transpile those.
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.
MIT License
FAQs
Backpack is a minimalistic build system for Node.js
We found that @paulxuca/backpack-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.