fix: handle empty env for app resources

This commit is contained in:
Igor Randjelovic
2021-03-02 18:49:51 +01:00
parent 3c44a553c3
commit 60293bb819
10 changed files with 53 additions and 123 deletions

View File

@ -41,21 +41,23 @@ export function removeCopyRule(glob: string) {
*/
export function applyCopyRules(config: Config) {
const entryDir = getEntryDirPath();
// todo: handle empty appResourcesPath?
// (the CLI should always pass the path - maybe not required)
const appResourcesFullPath = resolve(
getProjectRootPath(),
env.appResourcesPath
);
const globOptions = {
dot: false,
ignore: [
// ignore everything in App_Resources (regardless where they are located)
`${relative(entryDir, appResourcesFullPath)}/**`,
],
ignore: [],
};
// todo: do we need to handle empty appResourcesPath?
// (the CLI should always pass the path - maybe not required)
if (env.appResourcesPath) {
const appResourcesFullPath = resolve(
getProjectRootPath(),
env.appResourcesPath
);
// ignore everything in App_Resources (regardless where they are located)
globOptions.ignore.push(`${relative(entryDir, appResourcesFullPath)}/**`);
}
config.plugin('CopyWebpackPlugin').use(CopyWebpackPlugin, [
{
patterns: Array.from(copyRules).map((glob) => ({