fix: A couple minor bug fixes (#436)

* Fix so deref always returns an object.
* Fix SelectOnClick so it does not crash
* chore: fix demo's webpack.config.ts
* Fix space
This commit is contained in:
David Revay 2018-03-14 16:05:57 +10:00 committed by Roman Hotsiy
parent 390f6c1324
commit 5dc21af281
4 changed files with 18 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import { render } from 'react-dom';
import styled from 'styled-components';
import { resolve as urlResolve } from 'url';
import { RedocStandalone } from '../';
import { RedocStandalone } from '../src';
import ComboBox from './ComboBox';
const demos = [

View File

@ -29,6 +29,10 @@ export default {
extensions: ['.ts', '.tsx', '.js', '.json'],
},
node: {
fs: 'empty',
},
module: {
rules: [
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' },
@ -56,6 +60,17 @@ export default {
},
},
},
{
test: /node_modules\/(swagger2openapi|reftools)\/.*\.js$/,
use: {
loader: 'awesome-typescript-loader',
options: {
transpileOnly: true,
allowJs: true,
instance: 'ts2js-transpiler-only',
},
},
},
],
},
plugins: [

View File

@ -5,7 +5,7 @@ import { ClipboardService } from '../../services';
export class SelectOnClick extends React.PureComponent {
private child: HTMLDivElement | null;
handleClick = () => {
ClipboardService.selectElement(this.refs.child);
ClipboardService.selectElement(this.child);
};
render() {

View File

@ -105,7 +105,7 @@ export class OpenAPIParser {
} catch (e) {
// do nothing
}
return res;
return res || {};
};
/**