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