Skip to content
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

improve experiments.css support #5340

Open
4 of 11 tasks
ahabhgk opened this issue Jan 16, 2024 · 10 comments
Open
4 of 11 tasks

improve experiments.css support #5340

ahabhgk opened this issue Jan 16, 2024 · 10 comments
Labels
stale team The issue/pr is created by the member of Rspack.

Comments

@ahabhgk
Copy link
Contributor

ahabhgk commented Jan 16, 2024

Also see webpack/webpack#14893

  • Currently Rspack support experiments.css, but there are some inconsistent with webpack's, you can ignore them in this issue for now, we will make them consistent after the Rspack mini-css-extract-plugin is implemented align experiments.css behavior with webpack when support mini-css-extract-plugin #5096
  • This issue aims to improve the missing features that experiments.css currently not supported.
    • These are features implemented in webpack but missing in Rspack
      • image-set()
      • @import url("...") layer(test);
      • @import url("...") supports(...);
      • @import url("...") media query;
      • inherit layer, supports(...) and media from parent module
      • warnings for ordering issues
      • cascades css modules composes (a.css: [composes: b from "./b.css"], b.css: [composes: c from "./c.css"])
    • These are features that missing in both webpack and Rspack
      • contenthashing for CSS files
      • new URL("./style.css", import.meta.url): Gives an URL to a stylesheet including all styles. @import and url() are resolved.
      • supports CSS Module Scripts
      • implement /* webpackIgnore: true */ for url()/image-set()

If you want to implement features that missing in both webpack and Rspack, we encourage you also contribute it back to webpack.

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Jan 16, 2024
@sgarfinkel
Copy link

Is it possible to also get inlining support like vite has via a resource query ?inline?

@hardfist
Copy link
Contributor

Is it possible to also get inlining support like vite has via a resource query ?inline?

you can support this by custom rule or use rsbuild https://rsbuild.dev/guide/optimization/inline-assets#force-inlining

Copy link

stale bot commented Apr 22, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Apr 22, 2024
@ahabhgk
Copy link
Contributor Author

ahabhgk commented May 23, 2024

support image-set() in #6594

Copy link

stale bot commented Aug 13, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@stale stale bot added the stale label Aug 13, 2024
@hardfist
Copy link
Contributor

bump

@faga295
Copy link
Contributor

faga295 commented Sep 10, 2024

Css Module Scripts is also not missing in both webpack and Rspack

@ahabhgk
Copy link
Contributor Author

ahabhgk commented Sep 10, 2024

Added to the list, currently CSS Module Scripts is only available with css-loader

@leimonio
Copy link
Contributor

leimonio commented Sep 20, 2024

When CSS Modules are enabled, the styles are usually imported using the default export of the style module, especially in a React and Vue application context. Instead in the current CSS support the namedExport is the default configuration and expected behaviour.

https://nextjs.org/docs/app/building-your-application/styling/css#css-modules
https://vuejs.org/api/sfc-css-features.html#css-modules

import React from 'react'
import styles from './App.module.scss'

const App = () => {
  return (
    <div className={styles.container}>
      <header className={styles.header}>
        ...
      </header>
    </div>
  )
}

export default App

In that case I'd very much prefer this module.parser to be provided along with css/scss modules, a default configuration.

module.exports = {
  ...
  experiments: {
    css: true,
  },
  module: {
    parser: {
      'css/auto': {
        namedExports: false,
      },
      'css/module': {
        namedExports: false,
      },
    },
    rules: [...]
}

My main aim here would be to simplify the default required configuration for the CSS Modules.

Copy link

stale bot commented Nov 19, 2024

This issue has been automatically marked as stale because it has not had recent activity. If this issue is still affecting you, please leave any comment (for example, "bump"). We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

No branches or pull requests

6 participants