web-infra-dev / rspress

🦀💨 A fast Rspack-based static site generator.
https://rspress.dev
MIT License
1.19k stars 106 forks source link

[Bug]: globalStyles doesn't work since 1.18 #1057

Closed intpp closed 1 month ago

intpp commented 1 month ago

Version

npmPackages:
  rspress: ^1.19.2 => 1.19.2

Details

After update to any version above 1.17.1 globalStyles doesn't work.

Priority of my css variables override is coming earlier than vars.css

CleanShot 2024-05-07 at 10 05 41 CleanShot 2024-05-07 at 10 07 34

rspress.config.ts

import * as path from 'path';
import { defineConfig } from 'rspress/config';

export default defineConfig({
  root: path.join(__dirname, 'docs'),
  globalStyles: path.join(__dirname, 'styles/index.css'),
  title: 'Rspress',
  description: 'Rspack-based Static Site Generator',
  icon: '/rspress-icon.png',
  logo: {
    light: '/rspress-light-logo.png',
    dark: '/rspress-dark-logo.png',
  },
  themeConfig: {
    socialLinks: [
      { icon: 'github', mode: 'link', content: 'https://github.com/web-infra-dev/rspress' },
    ],
  },
});

Reproduce link

https://rspress.dev/

Reproduce Steps

in console:

  1. run pnpm create rspress@latest
  2. cd to created directory
  3. run pnpm i
  4. create index.css in styles directory
  5. add globalStyles to rspress.config.ts = path.join(__dirname, 'styles/index.css')
  6. try to override some variable in styles/index.css
  7. run pnpm dev