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
*`doctype` - string which will be prepended to output html, default value is `"<!DOCTYPE html>\n"`
175
180
*`replace` - function which will take output html (without doctype), and it should return new html
181
+
*`addOnChange` - boolean, default `true`. Will add `onChnage={() => false}` to every `<input>` with `value` or `checked` attribute. Used to omit ReactDOM warning about `value` prop without `onChange` handler.
176
182
*`templatePath` - path to wrapper of compiled jsx, default value is `express-engine-jsx/template.jsx`. Undefined variable `BODY` will be replaced with your compiled jsx code.
177
183
*`parserOptions` - options for [babel.parser](https://babeljs.io/docs/en/babel-parser#options)
178
184
*`templateOptions` - options for [babel.template](https://babeljs.io/docs/en/babel-template#options)
@@ -187,8 +193,8 @@ This is a function which you can use as regular `require` but this one can run j
187
193
188
194
It also can take optional second parameter - `currentWorkingDir` which should be an absolute path to file directory which calls `require` in case when you call `require` from some unusual place like debugger console.
189
195
190
-
Every compiled jsx file will be cached to `requireJSX.cache` object where key will be path to jsx file and value will be value of `module.exports` inside jsx file, usually react component.
191
-
You can delete any key in this cache, requireJSX will recompile jsx file on next call.
196
+
Every compiled jsx file will be cached to `requireJSX.cache` object where key will be path to jsx file without extension and value will be object `{moduleExports: ReactComponent|any, map: object|null}`.
197
+
You can delete any key in this cache, `requireJSX` will recompile jsx file on next call.
192
198
193
199
### convert
194
200
@@ -202,12 +208,16 @@ Arguments:
202
208
203
209
*`code` - string of jsx code
204
210
*`options`
205
-
*`addOnChange` - boolean, default `true`. Will add `onChnage={() => false}` to every `<input>` with `value` or `checked` attribute. Used to omit ReactDOM warning about `value` prop without `onChange` handler.
206
-
*`parserOptions` - options for [babel.parser](https://babeljs.io/docs/en/babel-parser#options)
211
+
*`path` - string, path to jsx file. Needed only for source map.
If you pass `sourceMap: true` or your `process.env.NODE_ENV !== 'production'` then `convert` will return object `{code: string, map: object}` instead of js code string.
220
+
211
221
It also has `convert.cache` object for compiled templates where keys are `templatePath` and values are functions created by [babel.template](https://babeljs.io/docs/en/babel-template)
0 commit comments