jaredpalmer / jaredpalmer/backpack

Integrate HappyPack to speed up builds

Open
#57 2 comments 5 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.4k
Forks
164
PR merge metrics
No merged PRs in 30d

Description

[HappyPack](https://github.com/amireh/happypack) significantly reduces webpack build times by using parallel execution.

I was able to make it work with babel-loader by adding the following to my `backpack.config.js`:
```js
const HappyPack = require('happypack');

module.exports = {
webpack: config => {
let babelOptions;
config.module.rules = config.module.rules.map(rule => {
if (rule.loader === 'babel-loader') {
babelOptions = rule.options;

return {
test: rule.test,
exclude: rule.exclude,
use: {
loader: require.resolve('happypack/loader'),
query: {id: 'babel'},
},
};
}

return rule;
});
config.plugins = [
...config.plugins,
new HappyPack({
id: 'babel',
loaders: [
{
path: require.resolve('babel-loader'),
query: babelOptions,
},
],
verbose: false,
}),
];

return config;
},
};
```

However, it would be great to have this set up by default.

Willing to make a PR if this is something you would want to add.

Contributor guide

Open the contributing guide

Research direction

Start with backpack.config.js and the webpack configuration hook described in the issue, then review the existing babel-loader rule and plugins. Compare the proposed HappyPack integration with the current build setup; done means HappyPack is configured by default and builds continue to process Babel files successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.