<script lang="tsx"> Compilation error
See original GitHub issueVersion
3.0.0-beta.14
Reproduction link
https://github.com/ccqiuqiu/vue-cli3-test
Steps to reproduce
1.使用vue-cli创建一个项目,选择babel、ts 2.修改home.vue,增加一个component组件,如下:
<template>
<div class="home">
<img src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js TypeScript App"/>
<component :is="component"></component>
</div>
</template>
<script lang="tsx">
import { Component, Vue } from 'vue-property-decorator';
import HelloWorld from '@/components/HelloWorld.vue'; // @ is an alias to /src
@Component({
components: {
HelloWorld,
},
})
export default class Home extends Vue {
private component: any = {
render: (h: any) => <div>dddd</div>
}
}
</script>
- 修改tsconfig.json中的target为es5 4.运行 npm run serve
What is expected?
希望能正常渲染jsx
What is actually happening?
异常信息
> vue-cli3@0.1.0 serve /Users/cc/Desktop/node/vue-cli3
> vue-cli-service serve
INFO Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
94% after seal
ERROR Failed to compile with 1 errors 09:51:42
error in ./src/views/Home.vue?vue&type=script&lang=tsx
Syntax Error: Unterminated regular expression (13:35)
11 | super(...arguments);
12 | this.component = {
> 13 | render: (h) => dddd < /div>
| ^
14 | };
15 | }
16 | };
@ ./src/views/Home.vue?vue&type=script&lang=tsx 1:0-268 1:284-287 1:289-554 1:289-554
@ ./src/views/Home.vue
@ ./src/router.ts
@ ./src/main.ts
@ multi (webpack)-dev-server/client/index.js (webpack)/hot/dev-server.js ./src/main.ts
No type errors found Version: typescript 2.8.3 Time: 3320ms
此异常通常在第一次启动的时候出现,重启有时候会正常,但是修改代码后,再重启又可能出现异常。
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
<script lang="tsx"> Compilation error · Issue #314 - GitHub
I rewrited World.tsx // World.vue.
Read more >Common script compilation errors - IBM
When you work with compiled scripts, a script can be saved in the script console only if it compiles correctly. If there is...
Read more >Script compilation error. How do I fix these? - Unity Answers
I am in the editor, after a long time of working hard on a project, I go to build and run, it gives...
Read more >ts-loader - npm
To output a built .d.ts file, you can use the DeclarationBundlerPlugin in your webpack config. Failing the build on TypeScript compilation error.
Read more >The Witcher 3 Script Compilation Errors Explained - GGRecon
Script compilation errors in The Witcher 3 can cause problems for players jumping back into the game with the new 4.0 update.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome! Thanks so much.
This is a bug in
ts-loader
using incorrectly cached loader options… working on a PR soon