Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Turbopack: respect a project’s browserslist config in both dev and build #63430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wbinnssmith opened this issue Mar 18, 2024 · 3 comments
Closed
Labels
created-by: Turbopack team PRs by the Turbopack team. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.

Comments

@wbinnssmith
Copy link
Member

wbinnssmith commented Mar 18, 2024

Right now the devserver uses a fixed browserlist that’s the latest versions of evergreen browsers. Instead, we should respect what the user has configured (browserslist field in package.json, .browserslistrc, etc.), like Next.js with webpack does.

PACK-2882

@wbinnssmith wbinnssmith added Turbopack Related to Turbopack with Next.js. created-by: Turbopack team PRs by the Turbopack team. labels Mar 18, 2024
@wbinnssmith
Copy link
Member Author

Related: #57718

@sokra sokra added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Mar 30, 2024
@gianpaj
Copy link

gianpaj commented Mar 28, 2025

Hi, I'm running next build on a Next.js 15.2.3 repo.

With this or without browserlist in the package.json, I see the exact same file sizes in the JS chunk files. Is that correct? Or am I looking at the wrong thing?

With browserlist:

$ next build
   ▲ Next.js 15.2.3
   - Environments: .env.local

   Creating an optimized production build ...
 ✓ Compiled successfully
   Skipping linting
 ✓ Checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (26/26)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                                 Size  First Load JS
┌ ○ /                                      151 B         101 kB
├ ○ /_not-found                            980 B         101 kB
├ ● /[lang]                              51.6 kB         188 kB

$ ls -la .next/static/chunks/app/\[lang\]
total 24
drwxr-xr-x  4 gianpaj  staff   128 28 Mar 12:26 (auth)
drwxr-xr-x  4 gianpaj  staff   128 28 Mar 12:26 (dashboard)
drwxr-xr-x  6 gianpaj  staff   192 28 Mar 12:26 .
drwxr-xr-x  8 gianpaj  staff   256 28 Mar 12:26 ..
-rw-r--r--  1 gianpaj  staff   365 28 Mar 12:26 layout-8ece5222f0e1ddeb.js
-rw-r--r--  1 gianpaj  staff  7105 28 Mar 12:26 page-b5504c12116ba1d2.js

Without browserlist:

$ next build
   ▲ Next.js 15.2.3
   - Environments: .env.local

   Creating an optimized production build ...
 ✓ Compiled successfully
   Skipping linting
 ✓ Checking validity of types
 ✓ Collecting page data
 ✓ Generating static pages (26/26)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                                 Size  First Load JS
┌ ○ /                                      151 B         101 kB
├ ○ /_not-found                            980 B         101 kB
├ ● /[lang]                              51.6 kB         188 kB

$ ls -la .next/static/chunks/app/\[lang\]
total 24
drwxr-xr-x  4 gianpaj  staff   128 28 Mar 12:22 (auth)
drwxr-xr-x  4 gianpaj  staff   128 28 Mar 12:22 (dashboard)
drwxr-xr-x  6 gianpaj  staff   192 28 Mar 12:22 .
drwxr-xr-x  8 gianpaj  staff   256 28 Mar 12:22 ..
-rw-r--r--  1 gianpaj  staff   365 28 Mar 12:22 layout-8ece5222f0e1ddeb.js
-rw-r--r--  1 gianpaj  staff  7105 28 Mar 12:22 page-b5504c12116ba1d2.js
details

in the package.json

"browserslist": [
    "chrome >0 and last 2.5 years",
    "edge >0 and last 2.5 years",
    "safari >0 and last 2.5 years",
    "firefox >0 and last 2.5 years",
    "and_chr >0 and last 2.5 years",
    "and_ff >0 and last 2.5 years",
    "ios >0 and last 2.5 years"
  ],
Relevant Packages:
  next: 15.2.3 // There is a newer version (15.2.4) available, upgrade recommended!
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.3

next.config.ts

/** @type {import('next').NextConfig} */
const nextConfig = {
  images: {
    remotePatterns: [
     //
    ],
  },
  eslint: {
    ignoreDuringBuilds: true,
  },

  async rewrites() {
    return [
      //
    ];
  },
  skipTrailingSlashRedirect: true,
};

const withBundleAnalyzer = require('@next/bundle-analyzer')({
  enabled: process.env.ANALYZE === 'true',
});

module.exports = withBundleAnalyzer(nextConfig);

tsconfig.json

{
  "compilerOptions": {
    "lib": ["dom", "dom.iterable", "esnext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "baseUrl": ".",
    "paths": {
      "@/*": ["./*"],
      "@/public/*": ["./public/*"]
    },
    "incremental": true,
    "plugins": [
      {
        "name": "next"
      }
    ],
    "strictNullChecks": true,
    "target": "ES2017"
  },
  "include": [
    "next-env.d.ts",
    "**/*.ts",
    "**/*.tsx",
    ".next/types/**/*.ts",
    "lib/supabase/*.d.ts"
  ],
  "exclude": ["node_modules"]
}

Thanks

PS: I'm happy to open another issue if this is not the correct issue to post this

@timneutkens
Copy link
Member

Going to close this issue given that browserslist support is already tracked by the failing tests on areweturboyet.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
created-by: Turbopack team PRs by the Turbopack team. linear: turbopack Confirmed issue that is tracked by the Turbopack team. Turbopack Related to Turbopack with Next.js.
Projects
None yet
Development

No branches or pull requests

4 participants