Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customRender 与 vue-loader@16.0.0-beta.6 及以上版本不适配 #2822

Closed
1 task done
kagawagao opened this issue Sep 10, 2020 · 2 comments
Closed
1 task done

customRender 与 vue-loader@16.0.0-beta.6 及以上版本不适配 #2822

kagawagao opened this issue Sep 10, 2020 · 2 comments
Labels

Comments

@kagawagao
Copy link
Contributor

kagawagao commented Sep 10, 2020

  • 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?

编译失败


vue-loader@16.0.0-beta.6 之后用了 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
    }
@Amour1688
Copy link
Member

vuejs/vue-cli#5868

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants