mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
refactor: add more tructure to runtime dir
This commit is contained in:
parent
aff2372650
commit
8414e64eeb
@ -102,9 +102,9 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
options.plugins.push(alias({
|
options.plugins.push(alias({
|
||||||
entries: {
|
entries: {
|
||||||
'~runtime': config.runtimeDir,
|
'~runtime': config.runtimeDir,
|
||||||
'~renderer': require.resolve(resolve(config.runtimeDir, renderer)),
|
'~renderer': require.resolve(resolve(config.runtimeDir, 'ssr', renderer)),
|
||||||
'~build': config.buildDir,
|
'~build': config.buildDir,
|
||||||
'~mock': require.resolve(resolve(config.runtimeDir, 'mock')),
|
'~mock': require.resolve(resolve(config.runtimeDir, 'utils/mock')),
|
||||||
...mocks.reduce((p, c) => ({ ...p, [c]: '~mock' }), {}),
|
...mocks.reduce((p, c) => ({ ...p, [c]: '~mock' }), {}),
|
||||||
...providedDeps.reduce((p, c) => ({ ...p, [c]: require.resolve(c) }), {})
|
...providedDeps.reduce((p, c) => ({ ...p, [c]: require.resolve(c) }), {})
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ if ('serviceWorker' in navigator) {
|
|||||||
</script>`.replace(/\n| +/g, '')
|
</script>`.replace(/\n| +/g, '')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
entry: '{{ runtimeDir }}/targets/service-worker',
|
||||||
targetDir: '{{ publicDir }}',
|
targetDir: '{{ publicDir }}',
|
||||||
nuxtHooks: {
|
nuxtHooks: {
|
||||||
'vue-renderer:ssr:templateParams' (params) {
|
'vue-renderer:ssr:templateParams' (params) {
|
||||||
|
@ -5,7 +5,7 @@ import { SLSOptions, SLSTarget } from '../config'
|
|||||||
import { worker } from './worker'
|
import { worker } from './worker'
|
||||||
|
|
||||||
export const cloudflare: SLSTarget = extendTarget(worker, {
|
export const cloudflare: SLSTarget = extendTarget(worker, {
|
||||||
entry: '{{ runtimeDir }}/cloudflare',
|
entry: '{{ runtimeDir }}/targets/cloudflare',
|
||||||
generateIgnore: [
|
generateIgnore: [
|
||||||
'wrangler.toml'
|
'wrangler.toml'
|
||||||
],
|
],
|
||||||
|
@ -4,7 +4,7 @@ import consola from 'consola'
|
|||||||
import { SLSTarget } from '../config'
|
import { SLSTarget } from '../config'
|
||||||
|
|
||||||
export const lambda: SLSTarget = {
|
export const lambda: SLSTarget = {
|
||||||
entry: '{{ runtimeDir }}/lambda',
|
entry: '{{ runtimeDir }}/targets/lambda',
|
||||||
hooks: {
|
hooks: {
|
||||||
'done' ({ rollupConfig }) {
|
'done' ({ rollupConfig }) {
|
||||||
const entry = relative(process.cwd(), rollupConfig.output.file).replace(/\.js$/, '')
|
const entry = relative(process.cwd(), rollupConfig.output.file).replace(/\.js$/, '')
|
||||||
|
@ -3,7 +3,7 @@ import consola from 'consola'
|
|||||||
import { SLSTarget } from '../config'
|
import { SLSTarget } from '../config'
|
||||||
|
|
||||||
export const node: SLSTarget = {
|
export const node: SLSTarget = {
|
||||||
entry: '{{ runtimeDir }}/node',
|
entry: '{{ runtimeDir }}/targets/node',
|
||||||
hooks: {
|
hooks: {
|
||||||
'done' ({ rollupConfig }) {
|
'done' ({ rollupConfig }) {
|
||||||
const entry = relative(process.cwd(), rollupConfig.output.file).replace(/\.js$/, '')
|
const entry = relative(process.cwd(), rollupConfig.output.file).replace(/\.js$/, '')
|
||||||
|
@ -12,7 +12,7 @@ const o=Date.now(),t=()=>Date.now()-o;process.hrtime=o=>{const e=Math.floor(.001
|
|||||||
`
|
`
|
||||||
|
|
||||||
export const worker: SLSTarget = {
|
export const worker: SLSTarget = {
|
||||||
entry: '{{ runtimeDir }}/worker',
|
entry: null, // Abstract
|
||||||
node: false,
|
node: false,
|
||||||
hooks: {
|
hooks: {
|
||||||
'rollup:before' ({ rollupConfig }) {
|
'rollup:before' ({ rollupConfig }) {
|
||||||
|
Loading…
Reference in New Issue
Block a user