Vue-next: vue-template-compiler throws with v3.0.0-alpha.4

Created on 29 Jan 2020  Â·  3Comments  Â·  Source: vuejs/vue-next

Version

3.0.0-alpha.4

Reproduction link

https://github.com/cexbrayat/vtc-repro

Steps to reproduce

This is a simple app created with the CLI, using the vue-next and the TS plugins:

npx @vue/cli create vtc-repro --inlinePreset '{"plugins": {"@vue/cli-plugin-typescript": {"classComponent": false},"vue-cli-plugin-vue-next": {}}}'

The first commit sets the version to Vue 3.0.0-alpha.3 and,
after fixing the component created, running yarn build succeeds.

The second commit bumps Vue to 3.0.0-alpha.4.
When running yarn build, the command now throws:

â ¹  Building for production...

 ERROR  Failed to compile with 1 errors                                                                                              14:30:17

 error  in [internal]

INTERNAL ERROR(undefined,undefined) When you use `vue` option, make sure to install `vue-template-compiler`.
stack trace:
Error: When you use `vue` option, make sure to install `vue-template-compiler`.
    at Function.resolveScriptBlock (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/fork-ts-checker-webpack-plugin/lib/VueProgram.js:194:19)
    at Object.host.getSourceFile (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/fork-ts-checker-webpack-plugin/lib/VueProgram.js:106:45)
    at findSourceFile (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90581:29)
    at processImportedModules (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90869:25)
    at findSourceFile (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90634:17)
    at /Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90480:85
    at getSourceFileFromReferenceWorker (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90447:34)
    at processSourceFile (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90480:13)
    at processRootFile (/Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:90310:13)
    at /Users/ced-pro/Code/test/vue-cli-tests/vtc-repro/node_modules/typescript/lib/typescript.js:89326:60

After spending some time investigating the issue, I think I've found the root cause.
vue-template-compiler starts by checking that the Vue version is the correct one.
So when using with Vue 3.0.0-alpha.4, we do have this error thrown.

Why is there no error with Vue 3.0.0-alpha.3? Because this line fails when trying to retrieve Vue version with ReferenceError: document is not defined. So the version returned is undefined and the check is OK.

Now that the document is not defined error has been fixed in alpha.4, the check retreives the proper version and fails.

What is expected?

yarn build should not throw

What is actually happening?

yarn build throws

Most helpful comment

I think this is an issue that should be fixed in vue-cli-plugin-vue-next by not including vue-template-compiler (which is for 2.x only)

All 3 comments

@yyx990803 I opened the issue in this repo for visibility, but maybe you prefer it in vue-template-compiler if I'm not mistaken on the root cause. Let me know if I need to move it and if I can help to fix it. I'm not sure about the best way: release a [email protected]? Just relax the check?

I think this is an issue that should be fixed in vue-cli-plugin-vue-next by not including vue-template-compiler (which is for 2.x only)

Thx for the feedback, I opened https://github.com/vuejs/vue-cli-plugin-vue-next/issues/5 to track it

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jfet97 picture jfet97  Â·  4Comments

chrisvfritz picture chrisvfritz  Â·  4Comments

cexbrayat picture cexbrayat  Â·  4Comments

NMFES picture NMFES  Â·  3Comments

skirtles-code picture skirtles-code  Â·  3Comments