(config: Config)
| 51 | * @internal |
| 52 | */ |
| 53 | export function applyCopyRules(config: Config) { |
| 54 | const entryDir = getEntryDirPath(); |
| 55 | const globOptions = { |
| 56 | dot: false, |
| 57 | ignore: [], |
| 58 | }; |
| 59 | |
| 60 | // todo: do we need to handle empty appResourcesPath? |
| 61 | // (the CLI should always pass the path - maybe not required) |
| 62 | if (env.appResourcesPath) { |
| 63 | const appResourcesFolderName = basename(env.appResourcesPath); |
| 64 | |
| 65 | // ignore everything in App_Resources (regardless where they are located) |
| 66 | globOptions.ignore.push(`**/${appResourcesFolderName}/**`); |
| 67 | } |
| 68 | |
| 69 | config.plugin('CopyWebpackPlugin').use(CopyWebpackPlugin, [ |
| 70 | { |
| 71 | patterns: Array.from(copyRules) |
| 72 | // reverted: removes valid rules occasionally (ie fonts) |
| 73 | // todo: re-visit in future... |
| 74 | // .filter((glob) => { |
| 75 | // if (process.env.NODE_ENV === 'test') { |
| 76 | // return true; |
| 77 | // } |
| 78 | // // remove rules that do not match any paths |
| 79 | // // prevents webpack watch mode from firing |
| 80 | // // due to "removed" paths. |
| 81 | // return globbySync(glob).length > 0; |
| 82 | // }) |
| 83 | .map((glob) => ({ |
| 84 | from: glob, |
| 85 | context: entryDir, |
| 86 | noErrorOnMissing: true, |
| 87 | globOptions, |
| 88 | })) |
| 89 | .concat(additionalCopyRules), |
| 90 | }, |
| 91 | ]); |
| 92 | } |
no test coverage detected