Skip to content

customRender 与 [email protected] 及以上版本不适配 #2822

Closed
@kagawagao

Description

@kagawagao
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.0-beta.5

Environment

vue: 3.0.0-rc.10
vue-loader: 16.0.0-beta.7

Reproduction link

https://github.com/kagawagao/antdv-vue-loader-16

Steps to reproduce

见示例仓库

What is expected?

能正常运行

What is actually happening?

编译失败


[email protected] 之后用了 compiler-sfccompileScript 来编译 script 代码,导致需要增加额外的插件来支持 jsx,因此编译失败

https://github.com/vuejs/vue-loader/blob/c30c4c7440d2466aa3c1cf043f4e520cc9def6b9/src/index.ts#L133-L139

// vue-loader
    try {
      script = (descriptor as any).scriptCompiled = compileScript(descriptor, {
        babelParserPlugins: options.babelParserPlugins
      })
    } catch (e) {
      loaderContext.emitError(e)
    }

https://github.com/vuejs/vue-next/blob/110e96d1524fa9ff6d2b1fb0f26af0c4d0cb6ff7/packages/compiler-sfc/src/compileScript.ts#L75-L84

// compiler-sfc
    const scriptAst = parse(script.content, {
      plugins,
      sourceType: 'module'
    }).program.body
    return {
      ...script,
      content: hasCssVars ? injectCssVarsCalls(sfc, plugins) : script.content,
      bindings: analyzeScriptBindings(scriptAst),
      scriptAst
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions