mirror of
https://github.com/bobwen-dev/react-templates
synced 2025-04-12 00:56:39 +02:00
convert es6 imports without brackets
This commit is contained in:
parent
8ca28b2f70
commit
e8d95c1a47
@ -349,10 +349,10 @@ module.exports = function () {
|
||||
```
|
||||
###### Compiled (with ES6 flag):
|
||||
```javascript
|
||||
import { React } from 'react/addons';
|
||||
import { _ } from 'lodash';
|
||||
import { MyComp } from 'comps/myComp';
|
||||
import { utils } from 'utils/utils';
|
||||
import React from 'react/addons';
|
||||
import _ from 'lodash';
|
||||
import MyComp from 'comps/myComp';
|
||||
import utils from 'utils/utils';
|
||||
function repeatItem1(item, itemIndex) {
|
||||
return React.createElement(MyComp, {}, React.createElement('div', {}, utils.toLower(item.name)));
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ function convertRT(html, reportContext, options) {
|
||||
if (options.modules === 'typescript') {
|
||||
vars = _(defines).map(function (reqVar, reqPath) { return 'import ' + reqVar + " = require('" + reqPath + "');"; }).join('\n');
|
||||
} else if (options.modules === 'es6') {
|
||||
vars = _(defines).map(function (reqVar, reqPath) { return 'import {' + reqVar + "} from '" + reqPath + "';"; }).join('\n');
|
||||
vars = _(defines).map(function (reqVar, reqPath) { return 'import ' + reqVar + " from '" + reqPath + "';"; }).join('\n');
|
||||
} else {
|
||||
vars = _(defines).map(function (reqVar, reqPath) { return 'var ' + reqVar + " = require('" + reqPath + "');"; }).join('\n');
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { React } from 'react/addons';
|
||||
import { _ } from 'lodash';
|
||||
import React from 'react/addons';
|
||||
import _ from 'lodash';
|
||||
export default function () {
|
||||
return React.createElement('div', {});
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user