From 949dbff04b1608ab913d0e4a18b457cef4b299ac Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Thu, 14 Apr 2016 19:13:49 -0700 Subject: [PATCH 1/3] Tweaking some things for environments --- app/actions/__tests__/requests.test.js | 1 + app/components/RequestBodyEditor.js | 4 +++- app/components/Sidebar.js | 2 +- app/components/base/Editor.js | 3 ++- app/components/base/KeyValueEditor.js | 12 +++++++---- .../dropdowns/RequestGroupActionsDropdown.js | 5 +++++ app/components/dropdowns/WorkspaceDropdown.js | 4 +++- app/components/modals/EnvironmentEditModal.js | 19 +++++++++++++----- app/components/modals/ModalContainer.js | 3 +-- app/containers/App.js | 6 +++--- app/css/components/dropdown.scss | 4 ++-- app/css/components/editor.scss | 3 ++- app/css/components/forms.scss | 1 + app/css/components/modal.scss | 1 + app/css/layout/base.scss | 20 +++++++++++++++++++ app/lib/render.js | 8 ++++---- app/validators/requestGroup.js | 18 ++++++++++++++--- package.json | 2 +- 18 files changed, 87 insertions(+), 29 deletions(-) diff --git a/app/actions/__tests__/requests.test.js b/app/actions/__tests__/requests.test.js index 4539f0fde..3c1d3be0a 100644 --- a/app/actions/__tests__/requests.test.js +++ b/app/actions/__tests__/requests.test.js @@ -6,6 +6,7 @@ jest.unmock('../../validators/request'); jest.unmock('../../reducers/requests'); jest.unmock('../../reducers/global'); jest.unmock('jsonschema'); +jest.unmock('nunjucks'); jest.unmock('redux-thunk'); jest.unmock('redux-mock-store'); diff --git a/app/components/RequestBodyEditor.js b/app/components/RequestBodyEditor.js index 7c18f083f..3a049cb7b 100644 --- a/app/components/RequestBodyEditor.js +++ b/app/components/RequestBodyEditor.js @@ -8,7 +8,9 @@ class RequestBodyEditor extends Component { render () { const {request, onChange, className} = this.props; - const mode = request.contentType || 'application/json'; + // console.log(request); + // const mode = request.contentType || 'application/json'; + const mode = 'application/json'; return (
-

+
    { return (
    -
    +
    {this._focusedPair = -1}} onKeyDown={this._keyDown.bind(this)}/>
    -
    +
       
    +
    {this._focusedPair = -1}} onKeyDown={this._keyDown.bind(this)}/>
    +
       
    +
  • + +
  • diff --git a/app/components/modals/ModalContainer.js b/app/components/modals/ModalContainer.js index 46d6f0aa9..ab3f3612b 100644 --- a/app/components/modals/ModalContainer.js +++ b/app/components/modals/ModalContainer.js @@ -65,8 +65,7 @@ class Modals extends Component { const isVisible = modals.find(m => m.id === id); const modal = React.createElement(c, { key: id, - onClose: () => actions.hideModal(id), - tall: true + onClose: () => actions.hideModal(id) }); return isVisible ? modal : null; })} diff --git a/app/containers/App.js b/app/containers/App.js index dc72fb1a4..152a56a5d 100644 --- a/app/containers/App.js +++ b/app/containers/App.js @@ -59,7 +59,7 @@ class App extends Component { request={activeRequest}/> -
    +
    actions.updateRequest({id: activeRequest.id, params})} @@ -67,7 +67,7 @@ class App extends Component {
    -
    +
    actions.updateRequest({id: activeRequest.id, authentication})} @@ -75,7 +75,7 @@ class App extends Component {
    -
    +
    actions.updateRequest({id: activeRequest.id, headers})} diff --git a/app/css/components/dropdown.scss b/app/css/components/dropdown.scss index 7d080eecb..e4dc7e307 100644 --- a/app/css/components/dropdown.scss +++ b/app/css/components/dropdown.scss @@ -34,7 +34,7 @@ & > button { font-size: $font-size-md; text-align: left; - padding: 10px $padding-md; + padding: 10px $padding-md 10px $padding-sm; width: 100%; display: block; color: $font-light-bg !important; @@ -50,7 +50,7 @@ i.fa { display: inline-block; width: 2em; - text-align: left; + text-align: center; } } } diff --git a/app/css/components/editor.scss b/app/css/components/editor.scss index 53aa2d931..71585711e 100644 --- a/app/css/components/editor.scss +++ b/app/css/components/editor.scss @@ -9,6 +9,7 @@ position: relative; display: flex; flex: 1 1 100%; + min-height: 5rem; .editor { box-sizing: border-box; @@ -45,7 +46,7 @@ .CodeMirror-lines { // Scroll past the end - padding-bottom: 100px; + //padding-bottom: 50px; } .CodeMirror-placeholder { diff --git a/app/css/components/forms.scss b/app/css/components/forms.scss index 72ff57339..0f9e6ff90 100644 --- a/app/css/components/forms.scss +++ b/app/css/components/forms.scss @@ -47,6 +47,7 @@ &.form-control--underlined { textarea, input { + border-radius: 0; border-top: 0; border-right: 0; border-left: 0; diff --git a/app/css/components/modal.scss b/app/css/components/modal.scss index 1fe3c7219..fdc27dda3 100644 --- a/app/css/components/modal.scss +++ b/app/css/components/modal.scss @@ -20,6 +20,7 @@ .modal__content { border-radius: $radius-md; box-sizing: border-box; + box-shadow: 0 0 2rem 0 rgba(0, 0, 0, 0.5); width: $modal-width; max-width: 100%; max-height: 100%; diff --git a/app/css/layout/base.scss b/app/css/layout/base.scss index 3227668d9..6251f42db 100644 --- a/app/css/layout/base.scss +++ b/app/css/layout/base.scss @@ -24,6 +24,22 @@ h2 { font-size: $font-size-xl; } +h3 { + font-size: $font-size-lg; +} + +h1, h2, h3 { + padding-top: 1.5em; +} + +hr { + width: 100%; + height: 1px; + background-color: $hl-md; + border: 0; + margin: $padding-md 0; +} + .text-center { text-align: center; } @@ -58,6 +74,10 @@ i.fa { white-space: nowrap; } +.no-pad { + padding: 0 !important; +} + .wide { width: 100%; } diff --git a/app/lib/render.js b/app/lib/render.js index d2089917d..322ce5a93 100644 --- a/app/lib/render.js +++ b/app/lib/render.js @@ -1,7 +1,7 @@ -import swig from 'swig' +import nunjucks from 'nunjucks' + +nunjucks.configure({ autoescape: false }); export default function (template, context) { - return swig.render(template, { - locals: context - }) + return nunjucks.renderString(template, context); } diff --git a/app/validators/requestGroup.js b/app/validators/requestGroup.js index 074c89417..65d638fdc 100644 --- a/app/validators/requestGroup.js +++ b/app/validators/requestGroup.js @@ -3,9 +3,19 @@ import {Validator} from 'jsonschema'; const validator = new Validator(); const environmentsSchema = { - id: '/RequestGroupEnvironment', + id: '/Environment', type: 'object', - properties: {} + properties: { + id: {type: 'string'}, + name: {type: 'string'}, + data: {type: 'object'} + }, + required: [ + 'data', + 'id', + 'name' + ], + additionalProperties: false }; const requestGroupSchema = { @@ -16,7 +26,7 @@ const requestGroupSchema = { created: {type: 'number', minimum: 1000000000000, maximum: 10000000000000}, modified: {type: 'number', minimum: 1000000000000, maximum: 10000000000000}, name: {type: 'string', minLength: 1}, - environment: {type: 'object'} + environment: {ref: '/Environment'} }, required: [ 'id', @@ -28,6 +38,8 @@ const requestGroupSchema = { additionalProperties: false }; +validator.addSchema(environmentsSchema); + export default function (requestGroup) { return validator.validate(requestGroup, requestGroupSchema); } diff --git a/package.json b/package.json index 8e38917db..2eb73186f 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "htmlhint": "^0.9.12", "jsonlint": "^1.6.2", "jsonschema": "^1.1.0", + "nunjucks": "^1.3.4", "react": "^0.14.7", "react-dom": "^0.14.7", "react-redux": "^4.4.1", @@ -21,7 +22,6 @@ "redux-logger": "^2.6.1", "redux-thunk": "^2.0.1", "request": "latest", - "swig": "^1.4.2", "webpack": "^1.12.14" }, "devDependencies": { From 8a4c4fcd4f0943009fc10c0a2bd5602f8b896520 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Thu, 14 Apr 2016 22:23:54 -0700 Subject: [PATCH 2/3] Refactored modals a bit --- app/actions/__tests__/requestgroups.test.js | 3 - app/actions/__tests__/requests.test.js | 4 -- app/actions/requests.js | 4 +- app/components/base/Modal.js | 44 +++--------- app/components/base/ModalBody.js | 10 +++ app/components/base/ModalFooter.js | 11 +++ app/components/base/ModalHeader.js | 20 ++++++ app/components/base/PromptModal.js | 11 +-- app/components/modals/EnvironmentEditModal.js | 44 ------------ .../modals/{ModalContainer.js => Prompts.js} | 68 ++++++------------- .../RequestGroupEnvironmentEditModal.js | 65 ++++++++++++++++++ app/containers/App.js | 21 ++++-- app/lib/render.js | 4 +- app/validators/__tests__/Request.test.js | 1 - package.json | 12 ++++ webpack/dev.electron.config.js | 3 +- 16 files changed, 177 insertions(+), 148 deletions(-) create mode 100644 app/components/base/ModalBody.js create mode 100644 app/components/base/ModalFooter.js create mode 100644 app/components/base/ModalHeader.js delete mode 100644 app/components/modals/EnvironmentEditModal.js rename app/components/modals/{ModalContainer.js => Prompts.js} (52%) create mode 100644 app/components/modals/RequestGroupEnvironmentEditModal.js diff --git a/app/actions/__tests__/requestgroups.test.js b/app/actions/__tests__/requestgroups.test.js index c4d63f194..e7b16763b 100644 --- a/app/actions/__tests__/requestgroups.test.js +++ b/app/actions/__tests__/requestgroups.test.js @@ -3,9 +3,6 @@ jest.unmock('../global'); jest.unmock('../../constants/global'); jest.unmock('../../constants/actionTypes'); jest.unmock('../../validators/requestGroup'); -jest.unmock('jsonschema'); -jest.unmock('redux-thunk'); -jest.unmock('redux-mock-store'); describe('RequestGroup Actions', () => { it('should add valid group', () => { diff --git a/app/actions/__tests__/requests.test.js b/app/actions/__tests__/requests.test.js index 3c1d3be0a..5591ddcbf 100644 --- a/app/actions/__tests__/requests.test.js +++ b/app/actions/__tests__/requests.test.js @@ -5,10 +5,6 @@ jest.unmock('../../constants/actionTypes'); jest.unmock('../../validators/request'); jest.unmock('../../reducers/requests'); jest.unmock('../../reducers/global'); -jest.unmock('jsonschema'); -jest.unmock('nunjucks'); -jest.unmock('redux-thunk'); -jest.unmock('redux-mock-store'); // Jest seems to barf when this isn't here jest.unmock('request'); diff --git a/app/actions/requests.js b/app/actions/requests.js index 2b05dd1aa..68a00d69c 100644 --- a/app/actions/requests.js +++ b/app/actions/requests.js @@ -1,6 +1,6 @@ import * as types from '../constants/actionTypes' import * as methods from '../constants/global' -import makeRequest from '../lib/request.electron' +import makeRequest from '../lib/request' import {loadStart, loadStop} from './global' import {showModal} from './modals' import {REQUEST_RENAME} from '../constants/modals' @@ -93,7 +93,7 @@ export function sendRequest (request) { if (err) { console.error(err); } - + dispatch(setResponse(request.id, response)); dispatch(loadStop()); }); diff --git a/app/components/base/Modal.js b/app/components/base/Modal.js index f7a53ba80..7c7892103 100644 --- a/app/components/base/Modal.js +++ b/app/components/base/Modal.js @@ -1,36 +1,6 @@ -import React, {Component, PropTypes} from 'react'; -import classnames from 'classnames'; - -const ModalHeader = (props) => ( -
    -
    -
    -
    - {props.children} -
    -
    -
    - -
    -
    -
    -); - -const ModalBody = (props) => ( -
    - {props.children} -
    -); - -const ModalFooter = (props) => ( -
    -
    - {props.children} -
    -
    -); +import React, {Component, PropTypes} from 'react' +import classnames from 'classnames' +import * as ModalActions from '../../actions/modals' class Modal extends Component { _handleClick (e) { @@ -70,7 +40,7 @@ class Modal extends Component { } componentDidMount () { - this.refs.modal.focus(); + this.refs.modal && this.refs.modal.focus(); } render () { @@ -80,7 +50,8 @@ class Modal extends Component { className={classnames('modal', 'grid', 'grid--center', this.props.className)} onKeyDown={this._keyDown.bind(this)} onClick={this._handleClick.bind(this)}> -
    +
    {this.props.children}
    @@ -93,4 +64,5 @@ Modal.propTypes = { tall: PropTypes.bool }; -export {Modal, ModalHeader, ModalBody, ModalFooter}; +export default Modal; + diff --git a/app/components/base/ModalBody.js b/app/components/base/ModalBody.js new file mode 100644 index 000000000..ef8de94e4 --- /dev/null +++ b/app/components/base/ModalBody.js @@ -0,0 +1,10 @@ +import React from 'react'; +import classnames from 'classnames'; + +const ModalBody = (props) => ( +
    + {props.children} +
    +); + +export default ModalBody; diff --git a/app/components/base/ModalFooter.js b/app/components/base/ModalFooter.js new file mode 100644 index 000000000..7dedb7fa4 --- /dev/null +++ b/app/components/base/ModalFooter.js @@ -0,0 +1,11 @@ +import React from 'react'; + +const ModalFooter = (props) => ( +
    +
    + {props.children} +
    +
    +); + +export default ModalFooter; diff --git a/app/components/base/ModalHeader.js b/app/components/base/ModalHeader.js new file mode 100644 index 000000000..d145cdb20 --- /dev/null +++ b/app/components/base/ModalHeader.js @@ -0,0 +1,20 @@ +import React from 'react'; + +const ModalHeader = (props) => ( +
    +
    +
    +
    + {props.children} +
    +
    +
    + +
    +
    +
    +); + +export default ModalHeader; diff --git a/app/components/base/PromptModal.js b/app/components/base/PromptModal.js index 7efcff3fb..002b544fe 100644 --- a/app/components/base/PromptModal.js +++ b/app/components/base/PromptModal.js @@ -1,5 +1,8 @@ -import React, {Component, PropTypes} from 'react'; -import {Modal, ModalHeader, ModalBody, ModalFooter} from './Modal' +import React, {Component, PropTypes} from 'react' +import Modal from './Modal' +import ModalBody from './ModalBody' +import ModalHeader from './ModalHeader' +import ModalFooter from './ModalFooter' class PromptModal extends Component { _onSubmit (e) { @@ -29,9 +32,9 @@ class PromptModal extends Component { } render () { - const {onClose, submitName, headerName} = this.props; + const {onClose, submitName, headerName, ...extraProps} = this.props; return ( - + {headerName}
    diff --git a/app/components/modals/EnvironmentEditModal.js b/app/components/modals/EnvironmentEditModal.js deleted file mode 100644 index be9b6d9f5..000000000 --- a/app/components/modals/EnvironmentEditModal.js +++ /dev/null @@ -1,44 +0,0 @@ -import React, {Component, PropTypes} from 'react' -import {Modal, ModalHeader, ModalBody, ModalFooter} from '../base/Modal' -import Editor from '../base/Editor' -import KeyValueEditor from '../base/KeyValueEditor' -import * as modalIds from '../../constants/modals' - -class EnvironmentEditModal extends Component { - render () { - const editorOptions = { - mode: 'application/json', - placeholder: '{ "array": [1, 2, 3, 4] }', - theme: 'neat' - }; - - return ( - - Environment Variables - -
    - {}} - pairs={[{name: 'foo', value: 'hello'}]} - namePlaceholder="BASE_URL" - valuePlaceholder="https://api.insomnia.com/v1"/> -
    - {/* -

    Hello

    - - */} -
    - - - -
    - ); - } -} - -EnvironmentEditModal.propTypes = {}; - -EnvironmentEditModal.defaultProps = { - id: modalIds.ENVIRONMENT_EDITOR -}; - -export default EnvironmentEditModal; diff --git a/app/components/modals/ModalContainer.js b/app/components/modals/Prompts.js similarity index 52% rename from app/components/modals/ModalContainer.js rename to app/components/modals/Prompts.js index ab3f3612b..f98073b44 100644 --- a/app/components/modals/ModalContainer.js +++ b/app/components/modals/Prompts.js @@ -7,14 +7,10 @@ import * as RequestGroupActions from '../../actions/requestGroups' import * as RequestActions from '../../actions/requests' import * as modalIds from '../../constants/modals' import PromptModal from '../base/PromptModal' -import EnvironmentEditModal from './EnvironmentEditModal' -class Modals extends Component { +class Prompts extends Component { constructor (props) { super(props); - this._modals = [ - EnvironmentEditModal - ]; this._prompts = {}; this._prompts[modalIds.REQUEST_RENAME] = { header: 'Rename Request', @@ -37,53 +33,33 @@ class Modals extends Component { const {modals, actions} = this.props; return ( -
    -
    - {Object.keys(this._prompts).map(id => { - const promptDef = this._prompts[id]; - const modal = modals.find(m => m.id === id); +
    + {Object.keys(this._prompts).map(id => { + const promptDef = this._prompts[id]; + const modal = modals.find(m => m.id === id); - if (!modal) { - return null; - } + if (!modal) { + return null; + } - return ( - actions.hideModal(modal.id)} - onSubmit={value => promptDef.onSubmit(modal, value)} - /> - ) - })} -
    -
    - {this._modals.map(c => { - const id = c.defaultProps.id; - const isVisible = modals.find(m => m.id === id); - const modal = React.createElement(c, { - key: id, - onClose: () => actions.hideModal(id) - }); - return isVisible ? modal : null; - })} -
    -
    - {/*
    -
    Request deleted
    - -
    */} -
    + return ( + actions.hideModal(modal.id)} + onSubmit={value => promptDef.onSubmit(modal, value)} + /> + ) + })}
    ); } } -Modals.propTypes = { +Prompts.propTypes = { actions: PropTypes.shape({ hideModal: PropTypes.func.isRequired, updateRequestGroup: PropTypes.func.isRequired, @@ -113,5 +89,5 @@ function mapDispatchToProps (dispatch) { export default connect( mapStateToProps, mapDispatchToProps -)(Modals); +)(Prompts); diff --git a/app/components/modals/RequestGroupEnvironmentEditModal.js b/app/components/modals/RequestGroupEnvironmentEditModal.js new file mode 100644 index 000000000..4bcd37810 --- /dev/null +++ b/app/components/modals/RequestGroupEnvironmentEditModal.js @@ -0,0 +1,65 @@ +import React, {Component, PropTypes} from 'react' +import Modal from '../base/Modal' +import ModalBody from '../base/ModalBody' +import ModalHeader from '../base/ModalHeader' +import ModalFooter from '../base/ModalFooter' +import Editor from '../base/Editor' +import KeyValueEditor from '../base/KeyValueEditor' +import * as modalIds from '../../constants/modals' + +class RequestGroupEnvironmentEditModal extends Component { + constructor (props) { + super(props); + this.state = { + pairs: [] + } + } + + _saveChanges () { + this.props.onChange(this.state.pairs); + } + + _keyValueChange (pairs) { + this.setState({pairs}); + } + + render () { + const editorOptions = { + mode: 'application/json', + placeholder: '{ "array": [1, 2, 3, 4] }', + theme: 'neat' + }; + + return ( + + Environment Variables + +
    + +
    + {/* +

    Hello

    + + */} +
    + + + +
    + ); + } +} + +RequestGroupEnvironmentEditModal.propTypes = { + // requestGroup: PropTypes.object.isRequired, + onChange: PropTypes.func.isRequired +}; + +RequestGroupEnvironmentEditModal.defaultProps = { + id: modalIds.ENVIRONMENT_EDITOR +}; + +export default RequestGroupEnvironmentEditModal; diff --git a/app/containers/App.js b/app/containers/App.js index 152a56a5d..3b6adde7b 100644 --- a/app/containers/App.js +++ b/app/containers/App.js @@ -4,17 +4,19 @@ import {bindActionCreators} from 'redux' import {Tab, Tabs, TabList, TabPanel} from 'react-tabs' import Editor from '../components/base/Editor' -import Modals from '../components/modals/ModalContainer' +import Prompts from '../components/modals/Prompts' import KeyValueEditor from '../components/base/KeyValueEditor' import RequestBodyEditor from '../components/RequestBodyEditor' import RequestAuthEditor from '../components/RequestAuthEditor' import RequestUrlBar from '../components/RequestUrlBar' import Sidebar from '../components/Sidebar' +import RequestGroupEnvironmentEditModal from '../components/modals/RequestGroupEnvironmentEditModal' import * as GlobalActions from '../actions/global' import * as RequestGroupActions from '../actions/requestGroups' import * as RequestActions from '../actions/requests' import * as ResponseActions from '../actions/responses' +import * as ModalActions from '../actions/modals' // Don't inject component styles (use our own) Tabs.setUseDefaultStyles(false); @@ -144,13 +146,19 @@ class App extends Component { } render () { - const {actions, requests, responses, requestGroups, tabs} = this.props; + const {actions, requests, responses, requestGroups, tabs, modals} = this.props; const activeRequest = requests.all.find(r => r.id === requests.active); const activeResponse = responses[activeRequest && activeRequest.id]; return (
    - + + {!modals.find(m => m.id === RequestGroupEnvironmentEditModal.defaultProps.id) ? null : ( + actions.hideModal(RequestGroupEnvironmentEditModal.defaultProps.id)} + onChange={v => console.log(v)} + /> + )} /node_modules/redux-thunk", + "/node_modules/redux-mock-store", + "/node_modules/nunjucks", + "/node_modules/jsonschema", "/node_modules/react", "/node_modules/react-dom", "/node_modules/react-addons-test-utils" + ], + "testFileExtensions": [ + "test.js" + ], + "moduleFileExtensions": [ + "js", + "electron.js", + "chrome.js" ] } } diff --git a/webpack/dev.electron.config.js b/webpack/dev.electron.config.js index 73b053112..86871e485 100644 --- a/webpack/dev.electron.config.js +++ b/webpack/dev.electron.config.js @@ -37,7 +37,8 @@ base.plugins = [ base.target = webpackTargetElectronRenderer(base); -base.resolve.extensions.push('electron.js'); +base.resolve.extensions.push('.electron.js'); +console.log(base); module.exports = base; From 61338d091c1d696861e6a95d63aabb7593502416 Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Fri, 15 Apr 2016 09:50:29 -0700 Subject: [PATCH 3/3] Made webpack config a bit better --- package.json | 1 + webpack/base.config.js | 21 ++++++++++++++++++--- webpack/dev.electron.config.js | 21 +++------------------ 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 57df69d90..da2f39e11 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "private": true, "version": "3.0.0", "description": "Insomnia App", + "main": "electron.js", "repository": { "type": "git", "url": "git@bitbucket.org:gschier/insomnia.git" diff --git a/webpack/base.config.js b/webpack/base.config.js index 4cebe8a41..214ccfa22 100644 --- a/webpack/base.config.js +++ b/webpack/base.config.js @@ -1,7 +1,8 @@ var path = require('path'); var webpack = require('webpack'); +var webpackTargetElectronRenderer = require('webpack-target-electron-renderer'); -module.exports = { +var config = { target: 'web', devtool: 'source-map', context: path.join(__dirname, '../app'), @@ -52,7 +53,21 @@ module.exports = { ] }, resolve: { - extensions: ['', '.js', '.jsx'], + extensions: ['', '.js', '.jsx', '.electron.js', '.chrome.js'], packageMains: ['webpack', 'browser', 'web', 'browserify', ['jam', 'main'], 'main'] - } + }, + plugins: [ + new webpack.DefinePlugin({ + __DEV__: true, + 'process.env': { + NODE_ENV: JSON.stringify('development') + } + }), + new webpack.ExternalsPlugin('commonjs', [ + 'request' + ]) + ] }; + +config.target = webpackTargetElectronRenderer(config); +module.exports = config; diff --git a/webpack/dev.electron.config.js b/webpack/dev.electron.config.js index 86871e485..4b333ca57 100644 --- a/webpack/dev.electron.config.js +++ b/webpack/dev.electron.config.js @@ -1,7 +1,6 @@ var path = require('path'); var webpack = require('webpack'); var base = require('./base.config'); -var webpackTargetElectronRenderer = require('webpack-target-electron-renderer'); base.entry = [ 'webpack-hot-middleware/client?path=http://localhost:3333/__webpack_hmr', @@ -21,24 +20,10 @@ for (var i = 0; i < base.module.loaders.length; i++) { } } -base.plugins = [ +base.plugins = base.plugins.concat([ new webpack.HotModuleReplacementPlugin(), - new webpack.NoErrorsPlugin(), - new webpack.DefinePlugin({ - __DEV__: true, - 'process.env': { - NODE_ENV: JSON.stringify('development') - } - }), - new webpack.ExternalsPlugin('commonjs', [ - 'request' - ]) -]; - -base.target = webpackTargetElectronRenderer(base); - -base.resolve.extensions.push('.electron.js'); -console.log(base); + new webpack.NoErrorsPlugin() +]); module.exports = base;