mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
chore: enable back automock plugin
This commit is contained in:
parent
6de295cc9f
commit
0199610834
@ -18,7 +18,7 @@ import { resolvePath, MODULE_DIR } from '../utils'
|
||||
import { dynamicRequire } from './plugins/dynamic-require'
|
||||
import { externals } from './plugins/externals'
|
||||
import { timing } from './plugins/timing'
|
||||
// import { autoMock } from './plugins/automock'
|
||||
import { autoMock } from './plugins/automock'
|
||||
import { staticAssets, dirnames } from './plugins/static'
|
||||
import { middleware } from './plugins/middleware'
|
||||
import { esbuild } from './plugins/esbuild'
|
||||
@ -190,7 +190,7 @@ export const getRollupConfig = (sigmaContext: SigmaContext) => {
|
||||
}))
|
||||
|
||||
// Automatically mock unresolved externals
|
||||
// rollupConfig.plugins.push(autoMock())
|
||||
rollupConfig.plugins.push(autoMock())
|
||||
|
||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
||||
rollupConfig.plugins.push(commonjs({
|
||||
|
@ -1,11 +1,8 @@
|
||||
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')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user