You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10-1
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ Join [solid discord](https://discord.com/invite/solidjs) and check the [troubles
20
20
21
21
## Requirements
22
22
23
-
We've recently made this module 100% esm compatible. As per [this document](https://nodejs.org/api/esm.html) it is strongly recommended to have at least version `14.13.0` of node installed.
23
+
This module 100% esm compatible. As per [this document](https://nodejs.org/api/esm.html) it is strongly recommended to have at least the version `14.13.0` of node installed.
24
24
25
25
You can check your current version of node by typing `node -v` in your terminal. If your version is below that one version I'd encourage you to either do an update globally or use a node version management tool such as [volta](https://volta.sh/) or [nvm](https://github.com/nvm-sh/nvm).
26
26
@@ -129,6 +129,13 @@ Pass any additional [babel transform options](https://babeljs.io/docs/en/options
129
129
Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).
130
130
They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).
Pass any additional [@babel/preset-typescript](https://babeljs.io/docs/en/babel-preset-typescript).
138
+
132
139
## Note on HMR
133
140
134
141
Starting from version `1.1.0`, this plugin handle automatic HMR via [solid-refresh](https://github.com/solidjs/solid-refresh).
@@ -165,6 +172,8 @@ if (import.meta.hot) {
165
172
166
173
- If one of your dependency spit out React code instead of Solid that means that they don't expose JSX properly. To get around it, you might want to manually exclude it from the [dependencies optimization](https://vitejs.dev/config/#optimizedeps-exclude)
167
174
175
+
- If you are trying to make [directives](https://www.solidjs.com/docs/latest/api#use%3A___) work and they somehow don't try setting the `options.typescript.onlyRemoveTypeImports` option to `true`
* Forcibly enables jsx parsing. Otherwise angle brackets will be treated as
53
+
* typescript's legacy type assertion var foo = <string>bar;. Also, isTSX:
54
+
* true requires allExtensions: true.
55
+
*
56
+
* @default false
57
+
*/
58
+
isTSX?: boolean;
59
+
60
+
/**
61
+
* Replace the function used when compiling JSX expressions. This is so that
62
+
* we know that the import is not a type import, and should not be removed.
63
+
*
64
+
* @default React
65
+
*/
66
+
jsxPragma?: string;
67
+
68
+
/**
69
+
* Replace the function used when compiling JSX fragment expressions. This
70
+
* is so that we know that the import is not a type import, and should not
71
+
* be removed.
72
+
*
73
+
* @default React.Fragment
74
+
*/
75
+
jsxPragmaFrag?: string;
76
+
77
+
/**
78
+
* Indicates that every file should be parsed as TS or TSX (depending on the
79
+
* isTSX option).
80
+
*
81
+
* @default false
82
+
*/
83
+
allExtensions?: boolean;
84
+
85
+
/**
86
+
* Enables compilation of TypeScript namespaces.
87
+
*
88
+
* @default uses the default set by @babel/plugin-transform-typescript.
89
+
*/
90
+
allowNamespaces?: boolean;
91
+
92
+
/**
93
+
* When enabled, type-only class fields are only removed if they are
94
+
* prefixed with the declare modifier:
95
+
*
96
+
* > NOTE: This will be enabled by default in Babel 8
97
+
*
98
+
* @default false
99
+
*
100
+
* @example
101
+
* ```ts
102
+
* class A {
103
+
* declare foo: string; // Removed
104
+
* bar: string; // Initialized to undefined
105
+
* prop?: string; // Initialized to undefined
106
+
* prop1!: string // Initialized to undefined
107
+
* }
108
+
* ```
109
+
*/
110
+
allowDeclareFields?: boolean;
111
+
112
+
/**
113
+
* When set to true, the transform will only remove type-only imports
114
+
* (introduced in TypeScript 3.8). This should only be used if you are using
115
+
* TypeScript >= 3.8.
116
+
*
117
+
* @default false
118
+
*/
119
+
onlyRemoveTypeImports?: boolean;
120
+
121
+
/**
122
+
* When set to true, Babel will inline enum values rather than using the
123
+
* usual enum output:
124
+
*
125
+
* This option differs from TypeScript's --isolatedModules behavior, which
126
+
* ignores the const modifier and compiles them as normal enums, and aligns
127
+
* Babel's behavior with TypeScript's default behavior.
128
+
*
129
+
* ```ts
130
+
* // Input
131
+
* const enum Animals {
132
+
* Fish
133
+
* }
134
+
* console.log(Animals.Fish);
135
+
*
136
+
* // Default output
137
+
* var Animals;
138
+
*
139
+
* (function (Animals) {
140
+
* Animals[Animals["Fish"] = 0] = "Fish";
141
+
* })(Animals || (Animals = {}));
142
+
*
143
+
* console.log(Animals.Fish);
144
+
*
145
+
* // `optimizeConstEnums` output
146
+
* console.log(0);
147
+
* ```
148
+
*
149
+
* However, when exporting a const enum Babel will compile it to a plain
150
+
* object literal so that it doesn't need to rely on cross-file analysis
151
+
* when compiling it:
152
+
*
153
+
* ```ts
154
+
* // Input
155
+
* export const enum Animals {
156
+
* Fish,
157
+
* }
158
+
*
159
+
* // `optimizeConstEnums` output
160
+
* export var Animals = {
161
+
* Fish: 0,
162
+
* };
163
+
* ```
164
+
*
165
+
* @default false
166
+
*/
167
+
optimizeConstEnums?: boolean;
168
+
};
50
169
/**
51
170
* Pass any additional [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/tree/main/packages/babel-plugin-jsx-dom-expressions#plugin-options).
52
171
* They will be merged with the defaults sets by [babel-preset-solid](https://github.com/solidjs/solid/blob/main/packages/babel-preset-solid/index.js#L8-L25).
0 commit comments