Skip to content

Commit

Permalink
feat(vite): use externality to resolve externals for ssr dev bundl…
Browse files Browse the repository at this point in the history
…er (#1172)
  • Loading branch information
danielroe authored Oct 20, 2021
1 parent 18d2a90 commit 6bac49b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface NitroHooks {
}

export interface NitroContext {
alias: Record<string, string>
timing: boolean
inlineDynamicImports: boolean
minify: boolean
Expand Down Expand Up @@ -87,6 +88,7 @@ export type NitroPreset = NitroInput | ((input: NitroInput) => NitroInput)

export function getNitroContext (nuxtOptions: NuxtOptions, input: NitroInput): NitroContext {
const defaults: NitroContext = {
alias: {},
timing: undefined,
inlineDynamicImports: undefined,
minify: undefined,
Expand Down
12 changes: 10 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
"ufo": "^0.7.9",
"unenv": "^0.3.10",
"unstorage": "^0.2.9",
"vue": "3.2.20",
"vue-bundle-renderer": "^0.3.2",
"vue-server-renderer": "^2.6.14"
},
Expand All @@ -76,7 +75,16 @@
"@types/http-proxy": "^1.17.7",
"@types/node-fetch": "^3.0.2",
"@types/serve-static": "^1.13.10",
"unbuild": "latest"
"unbuild": "latest",
"vue": "3.2.20"
},
"peerDependencies": {
"vue": "3.2.20"
},
"peerDependenciesMeta": {
"vue": {
"optional": true
}
},
"engines": {
"node": "^14.16.0 || ^16.11.0"
Expand Down
3 changes: 2 additions & 1 deletion src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
'@babel/parser': 'unenv/runtime/mock/proxy',
'@vue/compiler-core': 'unenv/runtime/mock/proxy',
'@vue/compiler-dom': 'unenv/runtime/mock/proxy',
'@vue/compiler-ssr': 'unenv/runtime/mock/proxy'
'@vue/compiler-ssr': 'unenv/runtime/mock/proxy',
...nitroContext.alias
}
}

Expand Down

0 comments on commit 6bac49b

Please sign in to comment.