electron-userland / electron-userland/electron-webpack
commonSourceDirectory config is buggy and wrongly documented
- Dominant language
- TypeScript
- Stars
- 902
- Forks
- 168
- PR merge metrics
- No merged PRs in 30d
Description
## Bug
The docs say that you can provide `commonSourceDirectory` configuration like `"commonSourceDirectory": "source/common"`, however if you look at the code in the node module you can clearly see that this would not work as expected:
```js
// watch common code
let commonSourceDir = configurator.electronWebpackConfiguration.commonSourceDirectory;
if (commonSourceDir == null) {
// not src/common, because it is convenient to just put some code into src to use it
commonSourceDir = _path.join(configurator.projectDir, "src");
}
```
The code expects either a full custom path to a `commonSourceDirectory` (which is hard to provide via .json config files) or it (correctly) builds the path relatively from the `projectDir` if nothing is specified. The correct code should look like this:
```js
let commonSourceDir = configurator.electronWebpackConfiguration.commonSourceDirectory || 'src';
commonSourceDir = _path.join(configurator.projectDir, commonSourceDir);
```
## Wrongly documented
Additionally the docs suggest that the `commonSourceDirectory` is for shared code … however it actually means the root directory (e.g: `src`/ `source`) where all code lives in, because the file watching relies on that.
… i ran into all of these issue just because i wanted to "customize" the `src` directory to `source` 😉
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the common-source watching code around configurator.electronWebpackConfiguration.commonSourceDirectory and compare it with the documented JSON configuration. Verify the relative-path behavior using a custom source directory, then update the documentation so commonSourceDirectory is described as the project’s code root rather than only shared code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, javascript, typescript, webpack
- Domain
- build-system, documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100