jaredpalmer / jaredpalmer/backpack
Async webpack config
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 4.4k
- Forks
- 164
- PR merge metrics
- No merged PRs in 30d
Description
I need to do some async work to create the webpack config. According to [webpack's docs](https://webpack.js.org/configuration/configuration-types/#exporting-a-promise), you can export a function that returns a promise to handle this.
However when I try to do a similar thing with backpack, I get an error.
Defining the webpack config as a function that returns a promise (or as an async function):
```javascript
module.exports = {
webpack: (config) => {
return new Promise((resolve, reject) => {
// config changes here
resolve(config);
});
}
};
```
results in:
```
WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration misses the property 'entry'.
object { : non-empty string | [non-empty string] } | non-empty string | [non-empty string] | function
The entry point(s) of the compilation.
at webpack (/Users/me/repos/project/node_modules/webpack/lib/webpack.js:19:9)
at Object. (/Users/me/repos/project/node_modules/backpack-core/bin/dev:28:24)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
```
Any chance that async configuration could be added to backpack as well?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at backpack-core/bin/dev, the entry point named in the stack trace, and compare its webpack configuration handling with webpack's documented promise-export behavior. Reproduce the reported async configuration and consider the work complete when it is accepted without the missing-entry validation error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, webpack
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100