mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
configurable nuxt version
This commit is contained in:
parent
54bb617474
commit
0c4225238a
@ -18,6 +18,7 @@ async function main () {
|
||||
rootDir,
|
||||
buildDir: '',
|
||||
targets: [],
|
||||
nuxt: 2,
|
||||
target: process.argv[3] && process.argv[3][0] !== '-' ? process.argv[3] : null,
|
||||
minify: process.argv.includes('--minify') ? true : null,
|
||||
analyze: process.argv.includes('--analyze') ? true : null,
|
||||
@ -37,7 +38,7 @@ async function main () {
|
||||
process.chdir(config.buildDir)
|
||||
|
||||
// Compile html template
|
||||
const htmlTemplateFile = resolve(config.buildDir, 'views/app.template.html') // TODO: nuxt3: document.template.html
|
||||
const htmlTemplateFile = resolve(config.buildDir, `views/${{ 2: 'app', 3: 'template' }[config.nuxt]}.template.html`)
|
||||
const htmlTemplateFileJS = htmlTemplateFile.replace(/.html$/, '.js').replace('app.', 'document.')
|
||||
const htmlTemplateContents = await readFile(htmlTemplateFile, 'utf-8')
|
||||
// eslint-disable-next-line no-template-curly-in-string
|
||||
|
@ -64,6 +64,7 @@ export const getRollupConfig = (config) => {
|
||||
options.plugins.push(alias({
|
||||
entries: {
|
||||
'~runtime': path.resolve(__dirname, 'runtime'),
|
||||
'~rendertostring': config.nuxt === 2 ? require.resolve('./runtime/vue2') : require.resolve('./runtime/vue3'),
|
||||
'~build': config.buildDir,
|
||||
'~mock': require.resolve('./runtime/mock'),
|
||||
...mocks.reduce((p, c) => ({ ...p, [c]: '~mock' }), {})
|
||||
|
@ -2,7 +2,7 @@ import { createRenderer } from 'vue-bundle-renderer'
|
||||
import devalue from '@nuxt/devalue'
|
||||
|
||||
// @ts-ignore
|
||||
import { renderToString } from './vue2'
|
||||
import { renderToString } from '~rendertostring'
|
||||
// @ts-ignore
|
||||
import server from '~build/dist/server/server'
|
||||
// @ts-ignore
|
||||
|
Loading…
Reference in New Issue
Block a user