Skip to content

Commit

Permalink
fix(plugin-vue-jsx): support ssr
Browse files Browse the repository at this point in the history
close #1939
  • Loading branch information
yyx990803 committed Feb 8, 2021
1 parent 30949d9 commit 281f55f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/plugin-vue-jsx/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const importMeta = require('@babel/plugin-syntax-import-meta')
const hash = require('hash-sum')

/**
* @param {import('.').Options} options
* @param {import('@vue/babel-plugin-jsx').VueJSXPluginOptions} options
* @returns {import('vite').Plugin}
*/
function vueJsxPlugin(options = {}) {
Expand Down Expand Up @@ -35,7 +35,7 @@ function vueJsxPlugin(options = {}) {
needSourceMap = config.command === 'serve' || !!config.build.sourcemap
},

transform(code, id) {
transform(code, id, ssr) {
if (/\.[jt]sx$/.test(id)) {
const plugins = [importMeta, [jsx, options]]
if (id.endsWith('.tsx')) {
Expand All @@ -53,7 +53,7 @@ function vueJsxPlugin(options = {}) {
sourceFileName: id
})

if (!needHmr) {
if (ssr || !needHmr) {
return {
code: result.code,
map: result.map
Expand Down

0 comments on commit 281f55f

Please sign in to comment.