Skip to content

Commit

Permalink
fix(nitro): exclude rootDir from externals and reinstate automock w…
Browse files Browse the repository at this point in the history
…arning (#66)
  • Loading branch information
danielroe authored Apr 9, 2021
1 parent 19cadd8 commit 5d9344f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/rollup/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
nitroContext._internal.runtimeDir,
...(nitroContext._nuxt.dev ? [] : [nitroContext._nuxt.buildDir]),
...nitroContext.middleware.map(m => m.handle),
nitroContext._nuxt.rootDir,
nitroContext._nuxt.serverDir
],
traceOptions: {
Expand Down
3 changes: 3 additions & 0 deletions src/rollup/plugins/automock.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import consola from 'consola'

export function autoMock () {
return {
name: 'auto-mock',
resolveId (src: string) {
if (src && !src.startsWith('.') && !src.includes('?') && !src.includes('.js')) {
consola.warn('Auto mock external ', src)
return {
id: require.resolve('@nuxt/un/runtime/mock/proxy')
}
Expand Down

0 comments on commit 5d9344f

Please sign in to comment.