mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
perf(rspack,webpack): drop lodash-es
dependency (#30409)
This commit is contained in:
parent
513659eb74
commit
b472d17135
@ -14,7 +14,7 @@ import { tryUseNuxt, useNuxt } from './context'
|
||||
import { resolveNuxtModule } from './resolve'
|
||||
|
||||
/**
|
||||
* Renders given template using lodash template during build into the project buildDir
|
||||
* Renders given template during build into the virtual file system (and optionally to disk in the project `buildDir`)
|
||||
*/
|
||||
export function addTemplate<T> (_template: NuxtTemplate<T> | string) {
|
||||
const nuxt = useNuxt()
|
||||
@ -44,7 +44,7 @@ export function addServerTemplate (template: NuxtServerTemplate) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders given types using lodash template during build into the project buildDir
|
||||
* Renders given types during build to disk in the project `buildDir`
|
||||
* and register them as types.
|
||||
*/
|
||||
export function addTypeTemplate<T> (_template: NuxtTypeTemplate<T>) {
|
||||
|
@ -46,7 +46,6 @@
|
||||
"h3": "^1.13.0",
|
||||
"jiti": "^2.4.2",
|
||||
"knitwork": "^1.2.0",
|
||||
"lodash-es": "4.17.21",
|
||||
"magic-string": "^0.30.17",
|
||||
"memfs": "^4.14.1",
|
||||
"ohash": "^1.1.4",
|
||||
@ -73,7 +72,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@types/lodash-es": "4.17.12",
|
||||
"@types/pify": "5.0.4",
|
||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||
"@types/webpack-hot-middleware": "2.25.9",
|
||||
|
@ -43,7 +43,6 @@
|
||||
"fork-ts-checker-webpack-plugin": "^9.0.2",
|
||||
"h3": "^1.13.0",
|
||||
"jiti": "^2.4.2",
|
||||
"lodash-es": "4.17.21",
|
||||
"magic-string": "^0.30.17",
|
||||
"memfs": "^4.14.1",
|
||||
"mini-css-extract-plugin": "^2.9.2",
|
||||
@ -73,7 +72,6 @@
|
||||
"devDependencies": {
|
||||
"@nuxt/schema": "workspace:*",
|
||||
"@rspack/core": "1.1.8",
|
||||
"@types/lodash-es": "4.17.12",
|
||||
"@types/pify": "5.0.4",
|
||||
"@types/webpack-bundle-analyzer": "4.7.0",
|
||||
"@types/webpack-hot-middleware": "2.25.9",
|
||||
|
@ -9,6 +9,7 @@ import escapeRegExp from 'escape-string-regexp'
|
||||
import { joinURL } from 'ufo'
|
||||
import type { NuxtOptions } from '@nuxt/schema'
|
||||
import { isTest } from 'std-env'
|
||||
import { defu } from 'defu'
|
||||
import type { WarningFilter } from '../plugins/warning-ignore'
|
||||
import WarningIgnorePlugin from '../plugins/warning-ignore'
|
||||
import type { WebpackConfigContext } from '../utils/config'
|
||||
@ -27,7 +28,7 @@ export async function base (ctx: WebpackConfigContext) {
|
||||
}
|
||||
|
||||
function baseConfig (ctx: WebpackConfigContext) {
|
||||
ctx.config = {
|
||||
ctx.config = defu({}, {
|
||||
name: ctx.name,
|
||||
entry: { app: [resolve(ctx.options.appDir, ctx.options.experimental.asyncEntry ? 'entry.async' : 'entry')] },
|
||||
module: { rules: [] },
|
||||
@ -45,7 +46,7 @@ function baseConfig (ctx: WebpackConfigContext) {
|
||||
output: getOutput(ctx),
|
||||
stats: statsMap[ctx.nuxt.options.logLevel] ?? statsMap.info,
|
||||
...ctx.config,
|
||||
}
|
||||
} satisfies Configuration)
|
||||
}
|
||||
|
||||
function basePlugins (ctx: WebpackConfigContext) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
import type { Configuration } from 'webpack'
|
||||
import type { Nuxt, NuxtOptions } from '@nuxt/schema'
|
||||
import { logger } from '@nuxt/kit'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import { toArray } from './index'
|
||||
|
||||
export interface WebpackConfigContext {
|
||||
@ -63,9 +62,3 @@ export function fileName (ctx: WebpackConfigContext, key: string) {
|
||||
|
||||
return fileName
|
||||
}
|
||||
|
||||
export function getWebpackConfig (ctx: WebpackConfigContext): Configuration {
|
||||
// Clone to avoid leaking config between Client and Server
|
||||
// TODO: rewrite webpack implementation to avoid necessity for this
|
||||
return cloneDeep(ctx.config)
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import { DynamicBasePlugin } from './plugins/dynamic-base'
|
||||
import { ChunkErrorPlugin } from './plugins/chunk'
|
||||
import { createMFS } from './utils/mfs'
|
||||
import { client, server } from './configs'
|
||||
import { applyPresets, createWebpackConfigContext, getWebpackConfig } from './utils/config'
|
||||
import { applyPresets, createWebpackConfigContext } from './utils/config'
|
||||
|
||||
import { builder, webpack } from '#builder'
|
||||
|
||||
@ -25,7 +25,7 @@ export const bundle: NuxtBuilder['bundle'] = async (nuxt) => {
|
||||
const ctx = createWebpackConfigContext(nuxt)
|
||||
ctx.userConfig = defu(nuxt.options.webpack[`$${preset.name as 'client' | 'server'}`], ctx.userConfig)
|
||||
await applyPresets(ctx, preset)
|
||||
return getWebpackConfig(ctx)
|
||||
return ctx.config
|
||||
}))
|
||||
|
||||
await nuxt.callHook(`${builder}:config`, webpackConfigs)
|
||||
|
@ -553,9 +553,6 @@ importers:
|
||||
knitwork:
|
||||
specifier: ^1.2.0
|
||||
version: 1.2.0
|
||||
lodash-es:
|
||||
specifier: 4.17.21
|
||||
version: 4.17.21
|
||||
magic-string:
|
||||
specifier: ^0.30.17
|
||||
version: 0.30.17
|
||||
@ -629,9 +626,6 @@ importers:
|
||||
'@nuxt/schema':
|
||||
specifier: workspace:*
|
||||
version: link:../schema
|
||||
'@types/lodash-es':
|
||||
specifier: 4.17.12
|
||||
version: 4.17.12
|
||||
'@types/pify':
|
||||
specifier: 5.0.4
|
||||
version: 5.0.4
|
||||
@ -958,9 +952,6 @@ importers:
|
||||
jiti:
|
||||
specifier: ^2.4.2
|
||||
version: 2.4.2
|
||||
lodash-es:
|
||||
specifier: 4.17.21
|
||||
version: 4.17.21
|
||||
magic-string:
|
||||
specifier: ^0.30.17
|
||||
version: 0.30.17
|
||||
@ -1043,9 +1034,6 @@ importers:
|
||||
'@rspack/core':
|
||||
specifier: 1.1.8
|
||||
version: 1.1.8
|
||||
'@types/lodash-es':
|
||||
specifier: 4.17.12
|
||||
version: 4.17.12
|
||||
'@types/pify':
|
||||
specifier: 5.0.4
|
||||
version: 5.0.4
|
||||
|
Loading…
Reference in New Issue
Block a user