mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-13 09:33:54 +00:00
fix: fix mocks and disable buffer since is unnecessary
This commit is contained in:
parent
e8f52bd383
commit
c8f4957520
@ -16,7 +16,7 @@ import { SLSOptions } from '../config'
|
|||||||
import { resolvePath } from '../utils'
|
import { resolvePath } from '../utils'
|
||||||
import dynamicRequire from './dynamic-require'
|
import dynamicRequire from './dynamic-require'
|
||||||
|
|
||||||
const mapArrToVal = (val, arr) => arr.reduce((p, c) => ({ ...p, [c]: val }))
|
const mapArrToVal = (val, arr) => arr.reduce((p, c) => ({ ...p, [c]: val }), {})
|
||||||
|
|
||||||
export type RollupConfig = InputOptions & { output: OutputOptions }
|
export type RollupConfig = InputOptions & { output: OutputOptions }
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
|
|
||||||
if (config.node === false) {
|
if (config.node === false) {
|
||||||
// Globals
|
// Globals
|
||||||
injects.Buffer = ['buffer', 'Buffer']
|
// injects.Buffer = ['buffer', 'Buffer'] <-- TODO: Make it opt-in
|
||||||
injects.process = '~mocks/node/process'
|
injects.process = '~mocks/node/process'
|
||||||
|
|
||||||
// Aliases
|
// Aliases
|
||||||
@ -66,7 +66,7 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
fs: '~mocks/node/fs',
|
fs: '~mocks/node/fs',
|
||||||
process: '~mocks/node/process',
|
process: '~mocks/node/process',
|
||||||
'node-process': require.resolve('process/browser.js'),
|
'node-process': require.resolve('process/browser.js'),
|
||||||
buffer: require.resolve('buffer/index.js'),
|
// buffer: require.resolve('buffer/index.js'),
|
||||||
util: require.resolve('util/util.js'),
|
util: require.resolve('util/util.js'),
|
||||||
events: require.resolve('events/events.js'),
|
events: require.resolve('events/events.js'),
|
||||||
inherits: require.resolve('inherits/inherits_browser.js'),
|
inherits: require.resolve('inherits/inherits_browser.js'),
|
||||||
@ -75,6 +75,12 @@ export const getRollupConfig = (config: SLSOptions) => {
|
|||||||
depd: '~mocks/custom/depd',
|
depd: '~mocks/custom/depd',
|
||||||
etag: '~mocks/generic/noop',
|
etag: '~mocks/generic/noop',
|
||||||
|
|
||||||
|
// Express
|
||||||
|
...mapArrToVal('~mocks/generic', [
|
||||||
|
'serve-static',
|
||||||
|
'iconv-lite'
|
||||||
|
]),
|
||||||
|
|
||||||
// Mime
|
// Mime
|
||||||
'mime-db': '~mocks/custom/mime-db',
|
'mime-db': '~mocks/custom/mime-db',
|
||||||
'mime/lite': require.resolve('mime/lite'),
|
'mime/lite': require.resolve('mime/lite'),
|
||||||
|
Loading…
Reference in New Issue
Block a user