mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-18 06:31:27 +00:00
fix: always mock generic dependencies
also inject after json
This commit is contained in:
parent
2384b8269e
commit
b65cd7862a
@ -33,7 +33,25 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
|
|
||||||
const injects:{ [key: string]: string| string[] } = {}
|
const injects:{ [key: string]: string| string[] } = {}
|
||||||
|
|
||||||
const aliases: {[key: string]: string} = {}
|
const aliases: { [key: string]: string } = {}
|
||||||
|
|
||||||
|
Object.assign(aliases, mapArrToVal('~mocks/generic', [
|
||||||
|
// @nuxt/devalue
|
||||||
|
'consola',
|
||||||
|
// vue2
|
||||||
|
'encoding',
|
||||||
|
'stream',
|
||||||
|
'he',
|
||||||
|
'resolve',
|
||||||
|
'source-map',
|
||||||
|
'lodash.template',
|
||||||
|
'serialize-javascript',
|
||||||
|
// vue3
|
||||||
|
'@babel/parser',
|
||||||
|
'@vue/compiler-core',
|
||||||
|
'@vue/compiler-dom',
|
||||||
|
'@vue/compiler-ssr'
|
||||||
|
]))
|
||||||
|
|
||||||
if (config.node === false) {
|
if (config.node === false) {
|
||||||
// Globals
|
// Globals
|
||||||
@ -41,24 +59,6 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
|
|
||||||
// Aliases
|
// Aliases
|
||||||
Object.assign(aliases, {
|
Object.assign(aliases, {
|
||||||
...mapArrToVal('~mocks/generic', [
|
|
||||||
// @nuxt/devalue
|
|
||||||
'consola',
|
|
||||||
// vue2
|
|
||||||
'encoding',
|
|
||||||
'stream',
|
|
||||||
'he',
|
|
||||||
'resolve',
|
|
||||||
'source-map',
|
|
||||||
'lodash.template',
|
|
||||||
'serialize-javascript',
|
|
||||||
// vue3
|
|
||||||
'@babel/parser',
|
|
||||||
'@vue/compiler-core',
|
|
||||||
'@vue/compiler-dom',
|
|
||||||
'@vue/compiler-ssr'
|
|
||||||
]),
|
|
||||||
|
|
||||||
// Node
|
// Node
|
||||||
...mapArrToVal('~mocks/generic', Module.builtinModules),
|
...mapArrToVal('~mocks/generic', Module.builtinModules),
|
||||||
http: '~mocks/node/http',
|
http: '~mocks/node/http',
|
||||||
@ -169,12 +169,12 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
extensions: extensions.filter(ext => ext !== '.json')
|
extensions: extensions.filter(ext => ext !== '.json')
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/inject
|
|
||||||
options.plugins.push(inject(injects))
|
|
||||||
|
|
||||||
// https://github.com/rollup/plugins/tree/master/packages/json
|
// https://github.com/rollup/plugins/tree/master/packages/json
|
||||||
options.plugins.push(json())
|
options.plugins.push(json())
|
||||||
|
|
||||||
|
// https://github.com/rollup/plugins/tree/master/packages/inject
|
||||||
|
options.plugins.push(inject(injects))
|
||||||
|
|
||||||
if (config.analyze) {
|
if (config.analyze) {
|
||||||
// https://github.com/doesdev/rollup-plugin-analyzer
|
// https://github.com/doesdev/rollup-plugin-analyzer
|
||||||
options.plugins.push(analyze())
|
options.plugins.push(analyze())
|
||||||
|
Loading…
Reference in New Issue
Block a user