Move webpack implementation into package folder#94129
Conversation
Stats cancelledCommit: 58b95ac |
Failing test suitesCommit: 58b95ac | About building and testing Next.js
Expand output● instant-nav-panel › transitions between capture types › should avoid showing stale SPA state when reloading from a captured SPA state into captured MPA state
Expand output● Instrumentation Client Hook › With src folder › should execute instrumentation-client from with src folder before hydration ● Instrumentation Client Hook › App Router › should execute instrumentation-client from app router before hydration ● Instrumentation Client Hook › Pages Router › should execute instrumentation-client from pages router before hydration ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a navigation ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a back/forward navigation ● Instrumentation Client Hook › instrumentationClientInject › runs each injected entry before the user instrumentation-client and before hydration, in array order ● Instrumentation Client Hook › instrumentationClientInject › still surfaces onRouterTransitionStart from the user instrumentation-client when injects are configured ● Instrumentation Client Hook › HMR in development mode › should reload instrumentation-client when modified
Expand output● instant-navigation-testing-api › renders runtime-prefetched content instantly during navigation
Expand output● app dir - next config › should support importing webpack in next.config
Expand output● Instrumentation Client Hook › With src folder › should execute instrumentation-client from with src folder before hydration ● Instrumentation Client Hook › App Router › should execute instrumentation-client from app router before hydration ● Instrumentation Client Hook › Pages Router › should execute instrumentation-client from pages router before hydration ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a navigation ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a back/forward navigation ● Instrumentation Client Hook › instrumentationClientInject › runs each injected entry before the user instrumentation-client and before hydration, in array order ● Instrumentation Client Hook › instrumentationClientInject › still surfaces onRouterTransitionStart from the user instrumentation-client when injects are configured
Expand output● app-dir - client-actions-tree-shaking › should not bundle unused server reference id in client bundles
Expand output● Instrumentation Client Hook › With src folder › should execute instrumentation-client from with src folder before hydration ● Instrumentation Client Hook › App Router › should execute instrumentation-client from app router before hydration ● Instrumentation Client Hook › Pages Router › should execute instrumentation-client from pages router before hydration ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a navigation ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a back/forward navigation ● Instrumentation Client Hook › instrumentationClientInject › runs each injected entry before the user instrumentation-client and before hydration, in array order ● Instrumentation Client Hook › instrumentationClientInject › still surfaces onRouterTransitionStart from the user instrumentation-client when injects are configured ● Instrumentation Client Hook › HMR in development mode › should reload instrumentation-client when modified
Expand output● react-performance-track › should show setTimeout ● react-performance-track › should show fetch ● react-performance-track › should show params ● react-performance-track › should show searchParams ● react-performance-track › should show cookies ● react-performance-track › should show draftMode ● react-performance-track › should show headers
Expand output● Instrumentation Client Hook › With src folder › should execute instrumentation-client from with src folder before hydration ● Instrumentation Client Hook › App Router › should execute instrumentation-client from app router before hydration ● Instrumentation Client Hook › Pages Router › should execute instrumentation-client from pages router before hydration ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a navigation ● Instrumentation Client Hook › onRouterTransitionStart › onRouterTransitionStart fires at the start of a back/forward navigation ● Instrumentation Client Hook › instrumentationClientInject › runs each injected entry before the user instrumentation-client and before hydration, in array order ● Instrumentation Client Hook › instrumentationClientInject › still surfaces onRouterTransitionStart from the user instrumentation-client when injects are configured ● Instrumentation Client Hook › HMR in development mode › should reload instrumentation-client when modified
Expand output● app dir - next config › should support importing webpack in next.config
... truncated to fit in one GitHub comment ... |
What?
Move the webpack implementation into
packages/next/src/webpackinside thenextpackage, with lazy Next core integration for webpack/rspack paths. Keep shared Babel and Sass compatibility code in neutral core build locations, includingresolve-url-loaderunderpackages/next/src/build/resolve-url-loader.Why?
Webpack is now opt-in, and keeping its implementation in a dedicated folder makes the support code easier to remove cleanly in the future while preserving
next --webpackandconfig.webpackbehavior.How?
Relocated webpack build/dev/loaders/plugins/vendor files under
src/webpack, addednext/dist/webpack/next-integrationas the internal lazy integration entry, moved shared manifest/trace/dev-page types to neutral core modules, updated Next-owned tests/scripts/storybook references, and adjusted package build output so webpack files compile todist/webpack. Generated webpack bundles and compiled webpack vendor files are ignored at their new paths.Verification
pnpm --filter=next buildpnpm --filter=next typespnpm pack-next --no-js-build --tarNEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-webpack test/e2e/webpack-require-hook/webpack-require-hook.test.tsNEXT_TEST_PREFER_OFFLINE=1 pnpm test-start-webpack test/production/webpack-config-mainjs/webpack-config-mainjs.test.tsNEXT_TEST_PREFER_OFFLINE=1 pnpm test-start-rspack test/e2e/hello-world/hello-world.test.tsNEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-turbo test/e2e/app-dir/scss/basic-module/basic-module.test.tsNEXT_TEST_PREFER_OFFLINE=1 pnpm test-dev-webpack test/e2e/app-dir/scss/basic-module/basic-module.test.tspnpm jest test/unit/next-babel-loader-dev.test.ts test/unit/next-babel-loader-prod.test.tslint-staged