diff --git a/packages/kit/src/template.ts b/packages/kit/src/template.ts index 5f232a86ec..6fd9f0947d 100644 --- a/packages/kit/src/template.ts +++ b/packages/kit/src/template.ts @@ -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 (_template: NuxtTemplate | 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 (_template: NuxtTypeTemplate) { diff --git a/packages/rspack/package.json b/packages/rspack/package.json index 0676f98453..b5158e12d1 100644 --- a/packages/rspack/package.json +++ b/packages/rspack/package.json @@ -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", diff --git a/packages/webpack/package.json b/packages/webpack/package.json index a72463a13f..a343c4a5f4 100644 --- a/packages/webpack/package.json +++ b/packages/webpack/package.json @@ -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", diff --git a/packages/webpack/src/presets/base.ts b/packages/webpack/src/presets/base.ts index 07b6052002..fc3890aae9 100644 --- a/packages/webpack/src/presets/base.ts +++ b/packages/webpack/src/presets/base.ts @@ -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) { diff --git a/packages/webpack/src/utils/config.ts b/packages/webpack/src/utils/config.ts index 526d5b111c..f7f01570ed 100644 --- a/packages/webpack/src/utils/config.ts +++ b/packages/webpack/src/utils/config.ts @@ -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) -} diff --git a/packages/webpack/src/webpack.ts b/packages/webpack/src/webpack.ts index 871ff8be51..ca8877b3bf 100644 --- a/packages/webpack/src/webpack.ts +++ b/packages/webpack/src/webpack.ts @@ -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) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01233dccbd..8604c275b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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