vitejs / vite

Next generation frontend tooling. It's fast!
http://vite.dev
MIT License
68.41k stars 6.17k forks source link

2.4.2 - RangeError: Maximum call stack size exceeded #4869

Closed SBJD closed 3 years ago

SBJD commented 3 years ago

Describe the bug

Hi everyone,

I have an important issue with Vitejs. I'm working with Craft (CMS), I was using webpack and I switched for vitejs but Swiper (7.0.1) doesn't seem to work with it.

I know there is a similar issue here https://github.com/vitejs/vite/issues/1591 but seens I am on Vite 2.4.2 I can't resolve it.

[vite:css] Maximum call stack size exceeded file: /var/www/html/src/styles.css error during build: RangeError: Maximum call stack size exceeded at /var/www/html/node_modules/swiper/swiper-bundle.min.css:13:12259 at Function.keys (<anonymous>) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:22:42) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17) error

Reproduction

I don't really know how to reproduce it seens Swiper was working on webpack but:

Install vite >= 2.x : https://vitejs.dev/guide/#scaffolding-your-first-vite-project Install Swiper: https://swiperjs.com/get-started

System Info

Vite version: 2.4.2
Operating System: Mac OS
Node version: v16.5.0
Package manager: yarn

Used Package Manager

yarn

Logs

$ vite build --debug
postcss-discard: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration
  vite:config bundled config file loaded in 7803ms +0ms
[dotenv][DEBUG] did not match key and value when parsing line 1: # The environment Craft is currently running in ("dev", "staging", "production", etc.)
[dotenv][DEBUG] did not match key and value when parsing line 3: 
[dotenv][DEBUG] did not match key and value when parsing line 4: # The application ID used to to uniquely store session and cache data, mutex locks, and more
[dotenv][DEBUG] did not match key and value when parsing line 6: 
[dotenv][DEBUG] did not match key and value when parsing line 7: # The secure key Craft will use for hashing and encrypting data
[dotenv][DEBUG] did not match key and value when parsing line 9: 
[dotenv][DEBUG] did not match key and value when parsing line 10: # The database driver that will be used ("mysql" or "pgsql")
[dotenv][DEBUG] did not match key and value when parsing line 12: 
[dotenv][DEBUG] did not match key and value when parsing line 13: # The database server name or IP address
[dotenv][DEBUG] did not match key and value when parsing line 15: 
[dotenv][DEBUG] did not match key and value when parsing line 16: # The port to connect to the database with
[dotenv][DEBUG] did not match key and value when parsing line 18: 
[dotenv][DEBUG] did not match key and value when parsing line 19: # The name of the database to select
[dotenv][DEBUG] did not match key and value when parsing line 21: 
[dotenv][DEBUG] did not match key and value when parsing line 22: # The database username to connect with
[dotenv][DEBUG] did not match key and value when parsing line 24: 
[dotenv][DEBUG] did not match key and value when parsing line 25: # The database password to connect with
[dotenv][DEBUG] did not match key and value when parsing line 27: 
[dotenv][DEBUG] did not match key and value when parsing line 28: # The database schema that will be used (PostgreSQL only)
[dotenv][DEBUG] did not match key and value when parsing line 30: 
[dotenv][DEBUG] did not match key and value when parsing line 31: # The prefix that should be added to generated table names (only necessary if multiple things are sharing the same database)
[dotenv][DEBUG] did not match key and value when parsing line 33: 
[dotenv][DEBUG] did not match key and value when parsing line 34: # Url for the default site
[dotenv][DEBUG] did not match key and value when parsing line 36: 
[dotenv][DEBUG] did not match key and value when parsing line 37: # The Data Source Name (“DSN”) for Sentry (add the client key here)
[dotenv][DEBUG] did not match key and value when parsing line 39: 
[dotenv][DEBUG] did not match key and value when parsing line 40: # SMTP host
[dotenv][DEBUG] did not match key and value when parsing line 42: 
[dotenv][DEBUG] did not match key and value when parsing line 43: #SMTP port
[dotenv][DEBUG] did not match key and value when parsing line 45: 
[dotenv][DEBUG] did not match key and value when parsing line 46: #SMTP user
[dotenv][DEBUG] did not match key and value when parsing line 48: 
[dotenv][DEBUG] did not match key and value when parsing line 49: #SMTP password
[dotenv][DEBUG] did not match key and value when parsing line 51: 
[dotenv][DEBUG] did not match key and value when parsing line 52: # Email sender
[dotenv][DEBUG] did not match key and value when parsing line 54: 
[dotenv][DEBUG] did not match key and value when parsing line 56: 
  vite:config using resolved config: {
  vite:config   base: '/assets/',
  vite:config   root: '/var/www/html/src',
  vite:config   build: {
  vite:config     target: [ 'es2019', 'edge88', 'firefox78', 'chrome87', 'safari13.1' ],
  vite:config     polyfillDynamicImport: false,
  vite:config     outDir: '/var/www/html/web/assets',
  vite:config     assetsDir: '',
  vite:config     assetsInlineLimit: 4096,
  vite:config     cssCodeSplit: true,
  vite:config     sourcemap: false,
  vite:config     rollupOptions: { input: [Object], output: [Array] },
  vite:config     commonjsOptions: { include: [Array], extensions: [Array] },
  vite:config     dynamicImportVarsOptions: { warnOnError: true, exclude: [Array] },
  vite:config     minify: 'terser',
  vite:config     terserOptions: {},
  vite:config     cleanCssOptions: {},
  vite:config     write: true,
  vite:config     emptyOutDir: false,
  vite:config     manifest: true,
  vite:config     lib: false,
  vite:config     ssr: false,
  vite:config     ssrManifest: false,
  vite:config     brotliSize: true,
  vite:config     chunkSizeWarningLimit: 500,
  vite:config     watch: null
  vite:config   },
  vite:config   resolve: { dedupe: undefined, alias: [ [Object], [Object] ] },
  vite:config   server: {
  vite:config     host: '0.0.0.0',
  vite:config     https: false,
  vite:config     port: 8080,
  vite:config     fs: { strict: undefined, allow: [Array] }
  vite:config   },
  vite:config   optimizeDeps: { include: [ 'swiper' ], esbuildOptions: { keepNames: undefined } },
  vite:config   plugins: [
  vite:config     'alias',
  vite:config     'vite:dynamic-import-polyfill',
  vite:config     'vite:resolve',
  vite:config     'vite:html',
  vite:config     'vite:css',
  vite:config     'vite:esbuild',
  vite:config     'vite:json',
  vite:config     'vite:wasm',
  vite:config     'vite:worker',
  vite:config     'vite:asset',
  vite:config     'legacy-config',
  vite:config     'legacy-generate-polyfill-chunk',
  vite:config     'legacy-env',
  vite:config     'imagemin',
  vite:config     'critical',
  vite:config     'vite:define',
  vite:config     'vite:css-post',
  vite:config     'vite:build-html',
  vite:config     'commonjs',
  vite:config     'vite:data-uri',
  vite:config     'rollup-plugin-dynamic-import-variables',
  vite:config     'asset-import-meta-url',
  vite:config     'legacy-post-process',
  vite:config     'vite:import-analysis',
  vite:config     'vite:esbuild-transpile',
  vite:config     'vite:terser',
  vite:config     'vite:manifest',
  vite:config     'vite:reporter',
  vite:config     'load-fallback'
  vite:config   ],
  vite:config   define: { 'import.meta.env.LEGACY': '__VITE_IS_LEGACY__' },
  vite:config   configFile: '/var/www/html/vite.config.ts',
  vite:config   configFileDependencies: [ 'vite.config.ts' ],
  vite:config   inlineConfig: {
  vite:config     root: undefined,
  vite:config     base: undefined,
  vite:config     mode: undefined,
  vite:config     configFile: undefined,
  vite:config     logLevel: undefined,
  vite:config     clearScreen: undefined,
  vite:config     build: {}
  vite:config   },
  vite:config   publicDir: '/var/www/html/src/public',
  vite:config   cacheDir: '/var/www/html/node_modules/.vite',
  vite:config   command: 'build',
  vite:config   mode: 'production',
  vite:config   isProduction: true,
  vite:config   env: { BASE_URL: '/assets/', MODE: 'production', DEV: false, PROD: true },
  vite:config   assetsInclude: [Function: assetsInclude],
  vite:config   logger: {
  vite:config     hasWarned: false,
  vite:config     info: [Function: info],
  vite:config     warn: [Function: warn],
  vite:config     warnOnce: [Function: warnOnce],
  vite:config     error: [Function: error],
  vite:config     clearScreen: [Function: clearScreen]
  vite:config   },
  vite:config   createResolver: [Function: createResolver]
  vite:config } +28ms
vite v2.4.4 building for production...
transforming (105) ../node_modules/swiper/core/images/loadImage.js  vite:resolve 6ms   tailwindcss/base.css -> /var/www/html/node_modules/tailwindcss/base.css +0ms
  vite:resolve 6ms   ~tailwindcss/base.css -> /var/www/html/node_modules/tailwindcss/base.css +0ms
  vite:resolve 3ms   tailwindcss/components.css -> /var/www/html/node_modules/tailwindcss/components.css +10ms
  vite:resolve 3ms   ~tailwindcss/components.css -> /var/www/html/node_modules/tailwindcss/components.css +0ms
  vite:resolve 2ms   tailwindcss/utilities.css -> /var/www/html/node_modules/tailwindcss/utilities.css +4ms
  vite:resolve 2ms   ~tailwindcss/utilities.css -> /var/www/html/node_modules/tailwindcss/utilities.css +0ms
  vite:resolve 0ms   css/base/_base.css -> /var/www/html/src/css/base/_base.css +2ms
  vite:resolve 0ms   css/base/_fonts.css -> /var/www/html/src/css/base/_fonts.css +3ms
  vite:resolve 0ms   css/base/_typography.css -> /var/www/html/src/css/base/_typography.css +6ms
  vite:resolve 0ms   css/base/_utilities.css -> /var/www/html/src/css/base/_utilities.css +2ms
  vite:resolve 1ms   css/components/_buttons.css -> /var/www/html/src/css/components/_buttons.css +2ms
  vite:resolve 0ms   css/components/_form.css -> /var/www/html/src/css/components/_form.css +4ms
  vite:resolve 0ms   css/components/_pagination.css -> /var/www/html/src/css/components/_pagination.css +4ms
  vite:resolve 1ms   css/components/_breadcrumb.css -> /var/www/html/src/css/components/_breadcrumb.css +3ms
  vite:resolve 0ms   css/components/_bullet-point.css -> /var/www/html/src/css/components/_bullet-point.css +2ms
  vite:resolve 0ms   css/components/_header-block.css -> /var/www/html/src/css/components/_header-block.css +2ms
  vite:resolve 0ms   css/components/_news-block.css -> /var/www/html/src/css/components/_news-block.css +3ms
  vite:resolve 0ms   css/components/_job-offer-block.css -> /var/www/html/src/css/components/_job-offer-block.css +3ms
  vite:resolve 1ms   css/components/_go-further-block.css -> /var/www/html/src/css/components/_go-further-block.css +3ms
  vite:resolve 0ms   css/components/_formation.css -> /var/www/html/src/css/components/_formation.css +2ms
  vite:resolve 0ms   css/components/_slider.css -> /var/www/html/src/css/components/_slider.css +2ms
  vite:resolve 0ms   css/components/_title-block.css -> /var/www/html/src/css/components/_title-block.css +2ms
  vite:resolve 0ms   css/components/_testimonial.css -> /var/www/html/src/css/components/_testimonial.css +2ms
  vite:resolve 0ms   css/components/_story-block.css -> /var/www/html/src/css/components/_story-block.css +2ms
  vite:resolve 0ms   css/components/_partner-block.css -> /var/www/html/src/css/components/_partner-block.css +3ms
  vite:resolve 0ms   css/layout/_footer.css -> /var/www/html/src/css/layout/_footer.css +2ms
  vite:resolve 0ms   css/layout/_header.css -> /var/www/html/src/css/layout/_header.css +2ms
  vite:resolve 0ms   css/vendors/_orejime.css -> /var/www/html/src/css/vendors/_orejime.css +2ms
  vite:resolve 7ms   orejime/dist/orejime.css -> /var/www/html/node_modules/orejime/dist/orejime.css +11ms
  vite:resolve 7ms   ~orejime/dist/orejime.css -> /var/www/html/node_modules/orejime/dist/orejime.css +0ms
  vite:resolve 0ms   css/base/_print.css -> /var/www/html/src/css/base/_print.css +10ms
  vite:resolve 0ms   css/base/_reduce-mode.css -> /var/www/html/src/css/base/_reduce-mode.css +3ms
  vite:resolve 0ms   ../node_modules/swiper/swiper-bundle.min.css -> /var/www/html/node_modules/swiper/swiper-bundle.min.css +3ms
  vite:resolve 0ms   ../node_modules/leaflet/dist/leaflet.css -> /var/www/html/node_modules/leaflet/dist/leaflet.css +11ms

warn - You have enabled the JIT engine which is currently in preview.
warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time.
Source path: /var/www/html/src/styles.css
Setting up new context...
Finding changed files: 93.497ms
Generate rules: 122.421ms
Build stylesheet: 5.446ms
Potential classes:  2935
Active contexts:  1
Content match entries 1432
JIT TOTAL: 658.833ms

✓ 111 modules transformed.
[vite:css] Maximum call stack size exceeded
file: /var/www/html/src/styles.css
error during build:
RangeError: Maximum call stack size exceeded
    at /var/www/html/node_modules/swiper/swiper-bundle.min.css:13:12259
    at Function.keys (<anonymous>)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:22:42)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
    at _clone (/var/www/html/node_modules/postcss-preset-env/node_modules/autoprefixer/lib/prefixer.js:38:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Failed to run yarn vite:build --debug: exit status 1

Validations

github-actions[bot] commented 3 years ago

Hello @SBJD. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction will be closed if they have no activity within 3 days.

haoqunjiang commented 3 years ago

The reproduction steps won't introduce postcss-preset-env to the project.

An actual reproduction repo is required.