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 { render } from 'react-dom';
import styled from 'styled-components'; import styled from 'styled-components';
import { resolve as urlResolve } from 'url'; import { resolve as urlResolve } from 'url';
import { RedocStandalone } from '../'; import { RedocStandalone } from '../src';
import ComboBox from './ComboBox'; import ComboBox from './ComboBox';
const demos = [ const demos = [

View File

@ -28,6 +28,10 @@ export default {
resolve: { resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'], extensions: ['.ts', '.tsx', '.js', '.json'],
}, },
node: {
fs: 'empty',
},
module: { module: {
rules: [ rules: [
@ -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: [ plugins: [

View File

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

View File

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