mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +00:00
fix(utils): node v8 not support dotAll in regex (#5608)
This commit is contained in:
parent
b7284e1b4a
commit
a21555c8cd
@ -14,11 +14,11 @@ export function normalizeFunctions(obj) {
|
||||
}
|
||||
if (typeof obj[key] === 'function') {
|
||||
const asString = obj[key].toString()
|
||||
const match = asString.match(/^([^{(]+)=>\s*(.*)/s)
|
||||
const match = asString.match(/^([^{(]+)=>\s*([\0-\uFFFF]*)/)
|
||||
if (match) {
|
||||
const fullFunctionBody = match[2].match(/^{?(\s*return\s+)?(.*?)}?$/s)
|
||||
const fullFunctionBody = match[2].match(/^{?(\s*return\s+)?([\0-\uFFFF]*?)}?$/)
|
||||
let functionBody = fullFunctionBody[2].trim()
|
||||
if (fullFunctionBody[1] || !match[2].trim().match(/^\s*{/s)) {
|
||||
if (fullFunctionBody[1] || !match[2].trim().match(/^\s*{/)) {
|
||||
functionBody = `return ${functionBody}`
|
||||
}
|
||||
// eslint-disable-next-line no-new-func
|
||||
|
Loading…
Reference in New Issue
Block a user