Open
Description
Instead of strings in each webpack config file. Would you be opposed to having a constants file for paths, etc? If someone wants to change where files live or are deployed, this would simplify where to make the changes.
const path = require('path');
const PathFragments = Object.freeze({
CLIENT: 'ClientApp',
WEB: 'wwwroot',
BUILD: 'dist',
SOURCE: 'src'
});
const Paths = Object.freeze({
client: Object.freeze({
SOURCE: `${PathFragments.CLIENT}/${PathFragments.SOURCE}`,
BUILD: `${PathFragments.CLIENT}/${PathFragments.BUILD}`
}),
web: Object.freeze({
BUILD: `${PathFragments.WEB}/${PathFragments.BUILD}`
})
});
const Roots = Object.freeze({
PROJECT: __dirname,
CLIENT: path.join(__dirname, PathFragments.CLIENT),
CLIENT_SOURCE: path.join(__dirname, Paths.client.SOURCE),
CLIENT_BUILD: path.join(__dirname, Paths.client.BUILD),
WEB: path.join(__dirname, PathFragments.WEB),
BUILD: path.join(__dirname, Paths.web.BUILD)
});
module.exports = Object.freeze({
PathFragments: PathFragments,
Paths: Paths,
Roots: Roots
});
(Should live in the root of the project so the __dirname
maps correctly.)
Just as an example. I didn't make a pull request because I wanted to get feedback first, and then ask what branch it should be submitted to.