This may be an unusual question. I want to explore the possibility of converting CSS/SCSS files into inline with HTML on production mode.
import styles from "./index.module.scss";
function Welcome(props) {
return <h1 className={styles.title}>Hello, Doe</h1>;
}
==== This will result something like this ======
<html>
<Head>
<link rel="stylesheet" href="/_next/static/style.css" />
</Head>
<body>
<h1 className="style_title3dwe">Hello, Doe</h1>
</body>
</html>
==== What i expect have on production is ======
<html>
<Head>
<style>
.style_title3dwe { font-size: var(--fs1); }
</style>
</Head>
<body>
<h1 className="style_title3dwe">Hello, Doe</h1>
</body>
</html>
style-loader documentation may help you
You can pass the
injectType
you need:injectType
can be one of the following values::P.S. In my current environment without setting up the
style-loader
, it works exactly as you described - added<style>
tags inside<head>
Codesandbox