Skip to content

Commit

Permalink
Fix the SVG rules
Browse files Browse the repository at this point in the history
  • Loading branch information
homer0 committed Apr 12, 2018
1 parent f878155 commit 0589929
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/services/configurations/rulesConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class WebpackRulesConfiguration extends ConfigurationFile {
// `.svg` files inside a `fonts` folder.
test: /\.svg(\?(v=\d+\.\d+\.\d+|\w+))?$/,
include: [
/\/node_modules\/(?:.*?\/)?fonts\/.*?/i,
new RegExp(`${target.paths.source}/(?:.*?/)?fonts/.*?`, 'i'),
...target.includeModules.map((modName) => (
new RegExp(`/node_modules/${modName}/(?:.*?/)?fonts/.*?`)
Expand Down Expand Up @@ -366,6 +367,7 @@ class WebpackRulesConfiguration extends ConfigurationFile {
*/
/favicon\.\w+$/i,
// Exclude svg files that were identified as fonts.
/\/node_modules\/(?:.*?\/)?fonts\/.*?/i,
new RegExp(`${target.paths.source}/(?:.*?/)?fonts/.*?`, 'i'),
// Exclude svg files that were identified as fonts on modules being processed.
...target.includeModules.map((modName) => (
Expand Down
2 changes: 2 additions & 0 deletions tests/services/configurations/rulesConfiguration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ describe('services/configurations:rulesConfiguration', () => {
{
test: expect.any(RegExp),
include: [
expect.any(RegExp),
expect.any(RegExp),
...target.includeModules.map(() => expect.any(RegExp)),
],
Expand Down Expand Up @@ -209,6 +210,7 @@ describe('services/configurations:rulesConfiguration', () => {
{
test: expect.any(RegExp),
exclude: expect.arrayContaining([
expect.any(RegExp),
expect.any(RegExp),
expect.any(RegExp),
...target.includeModules.map(() => expect.any(RegExp)),
Expand Down

0 comments on commit 0589929

Please sign in to comment.