Skip to content

Commit

Permalink
Fix/css module types (#823)
Browse files Browse the repository at this point in the history
* fix: Ensures ambient types are included in publish

* docs: Adds note on TS + CSS Module usage

* docs: Adding changeset
  • Loading branch information
rschristian authored Mar 28, 2021
1 parent fa3eac6 commit edcd777
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/dirty-islands-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'microbundle': patch
---

Ensures ambient type declaration for CSS Modules is included in the published bundle
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@
],
"files": [
"src",
"dist"
"dist",
"index.d.ts"
],
"author": "Jason Miller <jason@developit.ca> (http://jasonformat.com)",
"license": "MIT",
Expand Down

0 comments on commit edcd777

Please sign in to comment.