Skip to content

Commit

Permalink
Merge pull request #18038 from bisubus/fix-vue3-tsx
Browse files Browse the repository at this point in the history
Vue3: Add support for TSX in single file components
  • Loading branch information
yannbf authored May 17, 2022
2 parents 1b396fd + 97b199e commit ebf9341
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
15 changes: 14 additions & 1 deletion app/vue3/src/server/framework-preset-vue3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function webpack(config: Configuration): Configuration {
options: {},
},
{
test: /\.tsx?$/,
test: /\.ts$/,
use: [
{
loader: require.resolve('ts-loader'),
Expand All @@ -35,6 +35,19 @@ export function webpack(config: Configuration): Configuration {
},
],
},
{
test: /\.tsx$/,
use: [
{
loader: require.resolve('ts-loader'),
options: {
transpileOnly: true,
// Note this is different from the `appendTsSuffixTo` above!
appendTsxSuffixTo: [/\.vue$/],
},
},
],
},
],
},
resolve: {
Expand Down
16 changes: 15 additions & 1 deletion lib/core-server/src/__snapshots__/vue-3-cli_preview-dev-posix
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Object {
"test": "/\\\\.vue$/",
},
Object {
"test": "/\\\\.tsx?$/",
"test": "/\\\\.ts$/",
"use": Array [
Object {
"loader": "NODE_MODULES/ts-loader/index.js",
Expand All @@ -221,6 +221,20 @@ Object {
},
],
},
Object {
"test": "/\\\\.tsx$/",
"use": Array [
Object {
"loader": "NODE_MODULES/ts-loader/index.js",
"options": Object {
"appendTsxSuffixTo": Array [
"/\\\\.vue$/",
],
"transpileOnly": true,
},
},
],
},
Object {
"include": "NODE_MODULES\\\\/acorn-jsx/",
"test": "/\\\\.js$/",
Expand Down
16 changes: 15 additions & 1 deletion lib/core-server/src/__snapshots__/vue-3-cli_preview-prod-posix
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Object {
"test": "/\\\\.vue$/",
},
Object {
"test": "/\\\\.tsx?$/",
"test": "/\\\\.ts$/",
"use": Array [
Object {
"loader": "NODE_MODULES/ts-loader/index.js",
Expand All @@ -220,6 +220,20 @@ Object {
},
],
},
Object {
"test": "/\\\\.tsx$/",
"use": Array [
Object {
"loader": "NODE_MODULES/ts-loader/index.js",
"options": Object {
"appendTsxSuffixTo": Array [
"/\\\\.vue$/",
],
"transpileOnly": true,
},
},
],
},
Object {
"include": "NODE_MODULES\\\\/acorn-jsx/",
"test": "/\\\\.js$/",
Expand Down

0 comments on commit ebf9341

Please sign in to comment.