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({
|
||||
entries: {
|
||||
'~runtime': config.runtimeDir,
|
||||
'~renderer': require.resolve(resolve(config.runtimeDir, renderer)),
|
||||
'~renderer': require.resolve(resolve(config.runtimeDir, 'ssr', renderer)),
|
||||
'~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' }), {}),
|
||||
...providedDeps.reduce((p, c) => ({ ...p, [c]: require.resolve(c) }), {})
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ if ('serviceWorker' in navigator) {
|
||||
</script>`.replace(/\n| +/g, '')
|
||||
|
||||
return {
|
||||
entry: '{{ runtimeDir }}/targets/service-worker',
|
||||
targetDir: '{{ publicDir }}',
|
||||
nuxtHooks: {
|
||||
'vue-renderer:ssr:templateParams' (params) {
|
||||
|
@ -5,7 +5,7 @@ import { SLSOptions, SLSTarget } from '../config'
|
||||
import { worker } from './worker'
|
||||
|
||||
export const cloudflare: SLSTarget = extendTarget(worker, {
|
||||
entry: '{{ runtimeDir }}/cloudflare',
|
||||
entry: '{{ runtimeDir }}/targets/cloudflare',
|
||||
generateIgnore: [
|
||||
'wrangler.toml'
|
||||
],
|
||||
|
@ -4,7 +4,7 @@ import consola from 'consola'
|
||||
import { SLSTarget } from '../config'
|
||||
|
||||
export const lambda: SLSTarget = {
|
||||
entry: '{{ runtimeDir }}/lambda',
|
||||
entry: '{{ runtimeDir }}/targets/lambda',
|
||||
hooks: {
|
||||
'done' ({ rollupConfig }) {
|
||||
const entry = relative(process.cwd(), rollupConfig.output.file).replace(/\.js$/, '')
|
||||
|
@ -3,7 +3,7 @@ import consola from 'consola'
|
||||
import { SLSTarget } from '../config'
|
||||
|
||||
export const node: SLSTarget = {
|
||||
entry: '{{ runtimeDir }}/node',
|
||||
entry: '{{ runtimeDir }}/targets/node',
|
||||
hooks: {
|
||||
'done' ({ rollupConfig }) {
|
||||
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 = {
|
||||
entry: '{{ runtimeDir }}/worker',
|
||||
entry: null, // Abstract
|
||||
node: false,
|
||||
hooks: {
|
||||
'rollup:before' ({ rollupConfig }) {
|
||||
|
Loading…
Reference in New Issue
Block a user