diff --git a/config/merge-css-modules.js b/config/merge-css-modules.js index 9034a385174..59adb4d3794 100644 --- a/config/merge-css-modules.js +++ b/config/merge-css-modules.js @@ -4,6 +4,7 @@ import { glob } from 'glob'; const cssDir = resolve(process.cwd(), 'dist', 'css'); const cssIndexFile = resolve(cssDir, 'index.css'); +const cssIndexTypes = resolve(cssDir, 'index.d.css.ts'); const cssModules = await glob(`${cssDir}/**/*.module.css`); @@ -25,3 +26,10 @@ for (const cssModule of cssModules) { } writeFileSync(cssIndexFile, fileContent.join('\n')); +writeFileSync( + cssIndexTypes, + `declare const css: string; + +export default css; +`, +); diff --git a/packages/main/package.json b/packages/main/package.json index 898ea2f765c..59935337896 100644 --- a/packages/main/package.json +++ b/packages/main/package.json @@ -18,7 +18,10 @@ "default": "./wrappers/index.js" }, "./package.json": "./package.json", - "./styles.css": "./dist/css/index.css", + "./styles.css": { + "types": "./dist/css/index.d.css.ts", + "default": "./dist/css/index.css" + }, "./dist": "./dist/index.js", "./dist/*": "./dist/*", "./dist/*.js": "./dist/*.js",