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