fix(build): avoid importing @babel/parser in esm-bundler build
fix #4665
This commit is contained in:
parent
87c86e4cc2
commit
fc85ad28ae
@ -47,7 +47,8 @@ import {
|
|||||||
isObject,
|
isObject,
|
||||||
hyphenate,
|
hyphenate,
|
||||||
extend,
|
extend,
|
||||||
babelParserDefaultPlugins
|
babelParserDefaultPlugins,
|
||||||
|
NOOP
|
||||||
} from '@vue/shared'
|
} from '@vue/shared'
|
||||||
import { PropsExpression } from './transforms/transformElement'
|
import { PropsExpression } from './transforms/transformElement'
|
||||||
import { parseExpression } from '@babel/parser'
|
import { parseExpression } from '@babel/parser'
|
||||||
@ -161,10 +162,9 @@ export const isMemberExpressionBrowser = (path: string): boolean => {
|
|||||||
return !currentOpenBracketCount && !currentOpenParensCount
|
return !currentOpenBracketCount && !currentOpenParensCount
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isMemberExpressionNode = (
|
export const isMemberExpressionNode = __BROWSER__
|
||||||
path: string,
|
? NOOP
|
||||||
context: TransformContext
|
: (path: string, context: TransformContext): boolean => {
|
||||||
): boolean => {
|
|
||||||
try {
|
try {
|
||||||
let ret: Expression = parseExpression(path, {
|
let ret: Expression = parseExpression(path, {
|
||||||
plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
|
plugins: [...context.expressionPlugins, ...babelParserDefaultPlugins]
|
||||||
@ -180,7 +180,7 @@ export const isMemberExpressionNode = (
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isMemberExpression = __BROWSER__
|
export const isMemberExpression = __BROWSER__
|
||||||
? isMemberExpressionBrowser
|
? isMemberExpressionBrowser
|
||||||
|
Loading…
x
Reference in New Issue
Block a user