Open vamsaya opened 23 hours ago
js now supports importing css modules, the type is CSSStyleSheet, refer to the documentation. https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/import
demo.js
import reset from './reset.css' with { type: 'css' }; document.adoptedStyleSheets = [reset];
Unfortunately, Bun.build doesn't support this, and my suggestion is like this:
Bun.build({ loader: { ".css": "CSSStyleSheet", }, naming: { CSSStyleSheet: "/css/[name].css", } });
import reset from '/css/reset.css' with { type: 'css' }; document.adoptedStyleSheets = [reset];
Bun.Transpiler with similar functionality to Bun.build removes with { type: 'css' };, please improve it, 3Q
with { type: 'css' };
js now supports importing css modules, the type is CSSStyleSheet, refer to the documentation. https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Statements/import
demo.js
Unfortunately, Bun.build doesn't support this, and my suggestion is like this:
demo.js
Bun.Transpiler with similar functionality to Bun.build removes
with { type: 'css' };
, please improve it, 3Q