bluewings / pug-as-jsx-loader

MIT License
188 stars 15 forks source link

add option to support Mithril.js #34

Closed Onesimu closed 5 years ago

Onesimu commented 5 years ago

Now I edit the source of pug-as-jsx-utils and change in the index.js line 167 result.useFragment ? "import React, { Fragment } from 'react';" : "import React from 'react';", to result.useFragment ? "import m, { Fragment } from 'mithril';" : "import m from 'mithril';", it can work, but I think it's better to expose an option, like '@babel/plugin-transform-react-jsx', {"pragma": "m"} it's more convenient and useful. May consider.

bluewings commented 5 years ago

@Onesimu Added pragma: 'preact' | 'mithril' option. Please upgrade to version 1.0.72, try it out and let me know if it works. https://github.com/bluewings/pug-as-jsx-loader/blob/14259e7809314738585858fd27e7e507c271d029/test/issues.js#L39-L48