fix: remove md4 patch now that webpack has it in core (#23703)

This commit is contained in:
Daniel Roe 2023-10-16 15:21:27 +01:00 committed by GitHub
parent 937ecfe32e
commit fc65b362e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 14 deletions

View File

@ -520,17 +520,6 @@ export function getNuxtConfig (_options) {
options.build.indicator = false options.build.indicator = false
} }
// Monkey patch crypto.createHash in dev/build to upgrade hashing fnction
if (parseInt(process.versions.node.slice(0, 2)) > 16 && !options.buildModules.some(m => m.name === 'patchMD4')) {
options.buildModules.push(function patchMD4 () {
const crypto = require('crypto')
const _createHash = crypto.createHash
crypto.createHash = function (algorithm, options) {
return _createHash(algorithm === 'md4' ? 'md5' : algorithm, options)
}
})
}
// Components Module // Components Module
if (!options._start && getPKG('@nuxt/components')) { if (!options._start && getPKG('@nuxt/components')) {
options._modules.push('@nuxt/components') options._modules.push('@nuxt/components')

View File

@ -24,7 +24,6 @@ describe('config', () => {
UNIX_SOCKET: '/var/run/nuxt.sock' UNIX_SOCKET: '/var/run/nuxt.sock'
} }
const config = getDefaultNuxtConfig({ env }) const config = getDefaultNuxtConfig({ env })
config.buildModules = config.buildModules.filter(p => p.name !== 'patchMD4')
expect(config).toMatchSnapshot() expect(config).toMatchSnapshot()
}) })
}) })

View File

@ -34,7 +34,6 @@ describe('config: options', () => {
} }
} }
}) })
config.buildModules = config.buildModules.filter(p => p.name !== 'patchMD4')
expect(config).toMatchSnapshot() expect(config).toMatchSnapshot()
process.cwd.mockRestore() process.cwd.mockRestore()
@ -298,7 +297,7 @@ describe('config: options', () => {
const config = getNuxtConfig({ devModules: ['foo'], buildModules: ['bar'] }) const config = getNuxtConfig({ devModules: ['foo'], buildModules: ['bar'] })
expect(consola.warn).toHaveBeenCalledWith('`devModules` has been renamed to `buildModules` and will be removed in Nuxt 3.') expect(consola.warn).toHaveBeenCalledWith('`devModules` has been renamed to `buildModules` and will be removed in Nuxt 3.')
expect(config.devModules).toBe(undefined) expect(config.devModules).toBe(undefined)
expect(config.buildModules.filter(p => p.name !== 'patchMD4')).toEqual(['bar', 'foo']) expect(config.buildModules).toEqual(['bar', 'foo'])
}) })
test('should deprecate build.extractCSS.allChunks', () => { test('should deprecate build.extractCSS.allChunks', () => {