Fix/css module types (#823)

* fix: Ensures ambient types are included in publish

* docs: Adds note on TS + CSS Module usage

* docs: Adding changeset
This commit is contained in:
Ryan Christian 2021-03-28 13:51:39 -05:00 committed by GitHub
parent fa3eac6f49
commit edcd777cfa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
'microbundle': patch
---
Ensures ambient type declaration for CSS Modules is included in the published bundle

View File

@ -167,6 +167,8 @@ Just point the input to a `.ts` file through either the cli or the `source` key
Microbundle will generally respect your TypeScript config defined in a `tsconfig.json` file with notable exceptions being the "[target](https://www.typescriptlang.org/tsconfig#target)" and "[module](https://www.typescriptlang.org/tsconfig#module)" settings. To ensure your TypeScript configuration matches the configuration that Microbundle uses internally it's strongly recommended that you set `"module": "ESNext"` and `"target": "ESNext"` in your `tsconfig.json`.
If you're using TypeScript with CSS Modules, you will want to set `"include": ["node_modules/microbundle/index.d.ts"]` in your `tsconfig.json` to tell TypeScript how to handle your CSS Module imports.
### CSS and CSS Modules
Importing CSS files is supported via `import "./foo.css"`. By default, generated CSS output is written to disk. The `--css inline` command line option will inline generated CSS into your bundles as a string, returning the CSS string from the import:

View File

@ -67,7 +67,8 @@
],
"files": [
"src",
"dist"
"dist",
"index.d.ts"
],
"author": "Jason Miller <jason@developit.ca> (http://jasonformat.com)",
"license": "MIT",