Skip to content

Commit

Permalink
feat(loader): Update regex to be able to use double-quotes and single…
Browse files Browse the repository at this point in the history
…-quotes (#80)
  • Loading branch information
nording authored and brandonroberts committed Nov 14, 2017
1 parent 7d1f7f3 commit 0444b6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion spec/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,21 @@ describe('Loader', function() {
`loadChildren: "${modulePath}"`,
`loadChildren:"${modulePath}"`,
`loadChildren :"${modulePath}"`,
`loadChildren : "${modulePath}"`
`loadChildren : "${modulePath}"`,

`"loadChildren":"${modulePath}"`,
`"loadChildren": "${modulePath}"`,
`"loadChildren" : "${modulePath}"`,
`"loadChildren" : "${modulePath}"`,
`"loadChildren" :"${modulePath}"`,
`"loadChildren" : "${modulePath}"`,

`'loadChildren':"${modulePath}"`,
`'loadChildren': "${modulePath}"`,
`'loadChildren' : "${modulePath}"`,
`'loadChildren' : "${modulePath}"`,
`'loadChildren' :"${modulePath}"`,
`'loadChildren' : "${modulePath}"`
];

loadStrings.forEach(function(loadString) {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = function(source, sourcemap) {
this.cacheable && this.cacheable();

// regex for loadChildren string
var loadChildrenRegex = /loadChildren[\s]*:[\s]*['|"](.*?)['|"]/gm;
var loadChildrenRegex = /["']?loadChildren["']?[\s]*:[\s]*['|"](.*?)['|"]/gm;

// parse query params
var query = loaderUtils.getOptions(this) || {};
Expand Down

0 comments on commit 0444b6e

Please sign in to comment.