File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed
Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change 11# ` std.module.format `
22
3- > version 0.1.2
3+ > version 0.1.3
44
55- [ ` std.module.format ` ] ( #-stdmoduleformat- )
66 * [ Overview] ( #overview )
@@ -98,6 +98,43 @@ while ((m = regex.exec(str)) !== null) {
9898}
9999` ` `
100100
101+ ### Cheatsheet
102+
103+ ` ` ` ts twoslash
104+ // import the entire object
105+ import json from ' ./example.json'
106+ ` ` `
107+
108+ ` ` ` ts twoslash
109+ // import a root field as named exports - helps with tree-shaking!
110+ import { field } from ' ./example.json'
111+ ` ` `
112+
113+ Use the Type-Only Imports and Export syntax to avoid potential problems like type-only imports being incorrectly bundled. for example:
114+
115+ ` ` ` ts twoslash
116+ import type { T } from ' only/types'
117+ export type { T }
118+ ` ` `
119+ > [source, typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
120+
121+ #### Other Compiler Options Affecting the Build Result
122+ - ` extends `
123+ - ` importsNotUsedAsValues`
124+ - ` preserveValueImports`
125+ - ` jsxFactory`
126+ - ` jsxFragmentFactory`
127+
128+ #### Suggested ` tsconfig` values
129+ ` ` ` json
130+ [" useDefineForClassFields" : true ]
131+ ` ` `
132+ ` ` ` json
133+ [" isolatedModules" : true ]
134+ ` ` `
135+
136+ > [source, vitejs developer guide: vitejs.dev/guide/features.html#typescript-compiler-options](https://vitejs.dev/guide/features.html#typescript-compiler-options)
137+
101138## Avoid Default Exports and Prefer Named Exports
102139
103140### Context
You can’t perform that action at this time.
0 commit comments