Skip to content

Fix constructing RegExp TypeError#19

Closed
netil wants to merge 1 commit intoVa1:masterfrom
netil:typeError
Closed

Fix constructing RegExp TypeError#19
netil wants to merge 1 commit intoVa1:masterfrom
netil:typeError

Conversation

@netil
Copy link

@netil netil commented Feb 9, 2017

When dealing with multiple files and setting RegExp option, cause TypeError.

// webpack.config.js
module: {
	rules: [
                {
                    test: /\.js$/,
                    loader: "string-replace-loader",
                    options: {
                        multiple: [
				{ search: "foo", replace: "bar", flags: "g" },
			]
		}
	]
}

subquery param value is passed to processQuery() as below

  • first call: { search: 'foo', replace: 'bar', flags: 'g' }
  • next calls: { search: /foo/g, replace: 'bar', flags: 'g' }

Causing Module build failed: TypeError: Cannot supply flags when constructing one RegExp from another error.

This PR fix that issue

@Va1
Copy link
Owner

Va1 commented Mar 26, 2017

@netil
why would you supply both flags and regex search?

@Va1 Va1 closed this Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants