rollup-plugin-vue
Advanced tools
Comparing version 6.0.0-alpha.5 to 6.0.0-alpha.6
@@ -10,3 +10,3 @@ "use strict"; | ||
catch (e) { | ||
throw new Error('vue-loader requires @vue/compiler-sfc to be present in the dependency ' + | ||
throw new Error('rollup-plugin-vue requires @vue/compiler-sfc to be present in the dependency ' + | ||
'tree.'); | ||
@@ -97,2 +97,3 @@ } | ||
compiler: options.compiler, | ||
ssr: isServer, | ||
compilerOptions: { | ||
@@ -214,3 +215,3 @@ ...options.compilerOptions, | ||
} | ||
function transformVueSFC(code, resourcePath, descriptor, { rootContext, isProduction, }, options) { | ||
function transformVueSFC(code, resourcePath, descriptor, { rootContext, isProduction, isServer, }, options) { | ||
const shortFilePath = path_1.relative(rootContext, resourcePath) | ||
@@ -222,3 +223,3 @@ .replace(/^(\.\.[\/\\])+/, '') | ||
const hasScoped = descriptor.styles.some((s) => s.scoped); | ||
const templateImport = getTemplateCode(descriptor, resourcePath, id, hasScoped); | ||
const templateImport = getTemplateCode(descriptor, resourcePath, id, hasScoped, isServer); | ||
const scriptImport = getScriptCode(descriptor, resourcePath); | ||
@@ -230,3 +231,3 @@ const stylesCode = getStyleCode(descriptor, resourcePath, id, options.preprocessStyles); | ||
stylesCode, | ||
`script.render = render`, | ||
isServer ? `script.ssrRender = ssrRender` : `script.render = render`, | ||
]; | ||
@@ -242,6 +243,6 @@ if (hasScoped) { | ||
} | ||
output.push('export default script'); | ||
output.push('import { defineComponent } from "vue"; export default defineComponent(script)'); | ||
return output.join('\n'); | ||
} | ||
function getTemplateCode(descriptor, resourcePath, id, hasScoped) { | ||
function getTemplateCode(descriptor, resourcePath, id, hasScoped, isServer) { | ||
let templateImport = `const render = () => {}`; | ||
@@ -256,3 +257,3 @@ let templateRequest; | ||
templateRequest = _(src + query); | ||
templateImport = `import { render } from ${templateRequest}`; | ||
templateImport = `import { ${isServer ? 'ssrRender' : 'render'} } from ${templateRequest}`; | ||
} | ||
@@ -259,0 +260,0 @@ return templateImport; |
{ | ||
"name": "rollup-plugin-vue", | ||
"version": "6.0.0-alpha.5", | ||
"version": "6.0.0-alpha.6", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18826
384