From 2ec903d56c133c963a412b8683b1641fd8d99eae Mon Sep 17 00:00:00 2001 From: Olzzon Date: Tue, 3 Dec 2019 10:06:55 +0100 Subject: [PATCH] fix: Electron nodeIntegration: false - added preload.js - prepare for moving hw related stuff to server side fix: Webpack external - fs chore: clean up css --- main.js | 3 +- package.json | 27 ++++++-------- postcss.config.js | 24 ------------- preload.js | 35 +++++++++++++++++++ src/components/App.tsx | 2 +- src/components/CcgChannelSettings.tsx | 3 +- src/components/ChanStrip.tsx | 4 +-- src/components/ChannelMonitorOptions.tsx | 9 +++-- src/components/ChannelRouteSettings.tsx | 9 +++-- src/components/Channels.tsx | 5 ++- src/components/RoutingStorage.tsx | 11 +++--- src/components/Settings.tsx | 2 +- src/components/VuMeter.tsx | 3 +- src/constants/mixerProtocols/EmberLawo.ts | 2 +- .../mixerProtocols/StuderVistaEmber.ts | 2 +- .../mixerProtocols/casparCGMaster.ts | 2 +- src/index.ejs | 11 ++++++ src/index.tsx | 8 +++++ src/utils/AutomationConnection.ts | 3 +- src/utils/CasparCGConnection.ts | 18 +++++----- src/utils/EmberMixerConnection.ts | 4 +-- src/utils/HuiMidiRemoteConnection.ts | 9 ++--- src/utils/MidiMixerConnection.ts | 3 +- src/utils/OscMixerConnection.ts | 3 +- src/utils/QlClMixerConnection.ts | 3 +- src/utils/SSLMixerConnection.ts | 2 +- src/utils/SettingsStorage.ts | 8 +++-- tsconfig.json | 5 +++ webpack.build.config.js | 11 ++---- webpack.dev.config.js | 25 ++++++------- 30 files changed, 133 insertions(+), 123 deletions(-) delete mode 100644 postcss.config.js create mode 100644 preload.js create mode 100644 src/index.ejs diff --git a/main.js b/main.js index cd6d0313..8f68bea8 100644 --- a/main.js +++ b/main.js @@ -32,7 +32,8 @@ function createWindow() { // frame: false, show: false, webPreferences: { - nodeIntegration: true + nodeIntegration: false, + preload: path.join(__dirname, 'preload.js') } }) diff --git a/package.json b/package.json index fec7e2ac..238f4359 100644 --- a/package.json +++ b/package.json @@ -41,11 +41,6 @@ "watch": "jest --watch" }, "dependencies": { - "@types/hoist-non-react-statics": "^3.3.1", - "@types/rc-slider": "^8.6.5", - "@types/react-redux": "^7.1.4", - "@types/react-select": "^3.0.4", - "@types/react-test-renderer": "^16.9.1", "casparcg-connection": "^4.7.0", "classnames": "^2.2.6", "emberplus": "https://github.com/nrkno/tv-automation-emberplus-connection.git", @@ -56,7 +51,6 @@ "react-select": "^3.0.6", "react-slider": "^1.0.0", "redux": "^4.0.4", - "typescript": "^3.6.3", "webmidi": "^2.5.1" }, "devDependencies": { @@ -67,26 +61,25 @@ "@babel/preset-env": "^7.6.2", "@babel/preset-react": "^7.0.0", "@babel/preset-typescript": "^7.6.0", + "@types/hoist-non-react-statics": "^3.3.1", "@types/jest": "^24.0.21", + "@types/rc-slider": "^8.6.5", + "@types/react-redux": "^7.1.4", + "@types/react-select": "^3.0.4", + "@types/react-test-renderer": "^16.9.1", "babel-loader": "^8.0.6", - "babili-webpack-plugin": "^0.1.2", - "css-loader": "^3.2.0", - "electron": "^6.0.10", - "electron-packager": "^14.0.6", + "css-loader": "^3.2.1", + "electron": "^7.1.2", + "electron-packager": "^14.1.1", "file-loader": "^4.2.0", "html-webpack-plugin": "^3.2.0", "jest": "^24.9.0", - "mini-css-extract-plugin": "^0.8.0", - "postcss-cssnext": "^3.1.0", - "postcss-import": "^12.0.1", - "postcss-loader": "^3.0.0", - "postcss-nested": "^4.1.2", - "postcss-pxtorem": "^4.0.1", "react-test-renderer": "^16.11.0", - "style-loader": "^1.0.0", + "style-loader": "^1.0.1", "ts-jest": "^24.1.0", "ts-loader": "^6.2.0", "ts-node": "^8.4.1", + "typescript": "^3.6.3", "typescript-babel-jest": "^1.0.6", "webpack": "^4.41.0", "webpack-cli": "^3.3.9", diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 15faac7b..00000000 --- a/postcss.config.js +++ /dev/null @@ -1,24 +0,0 @@ -module.exports = { - plugins: { - 'postcss-cssnext': { - browsers: [ - 'Firefox >= 58', - 'Chrome >= 62', - 'ie >= 10', - 'last 4 versions', - 'Safari >= 9' - ] - }, - 'postcss-import': {}, - 'postcss-pxtorem': { - rootValue: 16, - unitPrecision: 5, - propList: ['*'], - selectorBlackList: ['html', 'body'], - replace: true, - mediaQuery: false, - minPixelValue: 0 - }, - 'postcss-nested': {} - } -} diff --git a/preload.js b/preload.js new file mode 100644 index 00000000..dc4dede8 --- /dev/null +++ b/preload.js @@ -0,0 +1,35 @@ +console.log('preloading') + +const remote = require('electron').remote +const { dialog } = require('electron').remote +const { getPath } = require('electron').remote.app + + +global.aaaasper = 'IT´s preloaded' +global.fs = remote.require('fs') +global.osc = remote.require('osc') +global.net = remote.require('net') +global.emberplus = remote.require('emberplus') +global.casparcgconnection = remote.require('casparcg-connection') +global.dialog = dialog +global.getPath = getPath + + +console.log('PreLoad executed') + +global.electron = { + ipc: { + invoke (channel, ...args) { + return ipcRenderer.invoke(channel, ...args) + }, + send (msg, arg) { + ipcRenderer.send(msg, arg) + }, + on (channel, cb) { + ipcRenderer.on(channel, cb) + }, + off (channel, cb) { + ipcRenderer.off(channel, cb) + } + } +} \ No newline at end of file diff --git a/src/components/App.tsx b/src/components/App.tsx index 386c97ed..6b5e9fa9 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -36,7 +36,7 @@ class App extends React.Component { if (this.props.store.settings[0].enableRemoteFader){ (window as any).huiRemoteConnection = new HuiMidiRemoteConnection(); } - this.settingsPath = electron.remote.app.getPath('userData'); + this.settingsPath = window.getPath('userData'); this.snapShopStoreTimer(); let selectedProtocol = MixerProtocolPresets[this.props.store.settings[0].mixerProtocol]; diff --git a/src/components/CcgChannelSettings.tsx b/src/components/CcgChannelSettings.tsx index ed5cc48a..28f6f384 100644 --- a/src/components/CcgChannelSettings.tsx +++ b/src/components/CcgChannelSettings.tsx @@ -2,10 +2,9 @@ import React from 'react'; import '../assets/css/CcgChannelSettings.css'; import { MixerProtocolPresets } from '../constants/MixerProtocolPresets'; -import { IMixerProtocolGeneric, ICasparCGMixerGeometry } from '../constants/MixerProtocolInterface'; +import { ICasparCGMixerGeometry } from '../constants/MixerProtocolInterface'; import { Store } from 'redux'; import { connect } from 'react-redux'; -import { IStore } from '../reducers/indexReducer'; import { SET_OPTION } from '../reducers/channelActions' import { TOGGLE_SHOW_OPTION } from '../reducers/settingsActions' diff --git a/src/components/ChanStrip.tsx b/src/components/ChanStrip.tsx index 862b4fb1..340f8451 100644 --- a/src/components/ChanStrip.tsx +++ b/src/components/ChanStrip.tsx @@ -1,4 +1,4 @@ -import React, { ChangeEvent } from 'react'; +import React from 'react'; import ReactSlider from 'react-slider' import '../assets/css/ChanStrip.css'; @@ -12,7 +12,7 @@ import { TOGGLE_SHOW_MONITOR_OPTIONS } from '../reducers/settingsActions' import { IFader } from '../reducers/fadersReducer' -import { SET_FADER_LEVEL, SET_FADER_THRESHOLD, SET_FADER_RATIO, SET_FADER_LOW, SET_FADER_MID, SET_FADER_HIGH, SET_FADER_MONITOR } from '../reducers/faderActions' +import { SET_FADER_THRESHOLD, SET_FADER_RATIO, SET_FADER_LOW, SET_FADER_MID, SET_FADER_HIGH } from '../reducers/faderActions' import { SET_AUX_LEVEL } from '../reducers/channelActions'; interface IChanStripInjectProps { diff --git a/src/components/ChannelMonitorOptions.tsx b/src/components/ChannelMonitorOptions.tsx index 43b7c805..1b73d7ca 100644 --- a/src/components/ChannelMonitorOptions.tsx +++ b/src/components/ChannelMonitorOptions.tsx @@ -11,7 +11,6 @@ import { SET_AUX_LEVEL } from '../reducers/channelActions' import { TOGGLE_SHOW_MONITOR_OPTIONS } from '../reducers/settingsActions' import { SET_FADER_MONITOR } from '../reducers/faderActions'; import { ISettings } from '../reducers/settingsReducer'; -const { dialog } = require('electron').remote; interface IMonitorSettingsInjectProps { label: string, @@ -46,7 +45,7 @@ class ChannelMonitorOptions extends React.PureComponent { this.props.dispatch({ @@ -106,7 +105,7 @@ class ChannelMonitorOptions extends React.PureComponent { this.props.dispatch({ diff --git a/src/components/ChannelRouteSettings.tsx b/src/components/ChannelRouteSettings.tsx index e3f79254..734e6463 100644 --- a/src/components/ChannelRouteSettings.tsx +++ b/src/components/ChannelRouteSettings.tsx @@ -10,7 +10,6 @@ import { connect } from 'react-redux'; import CcgChannelSettings from './CcgChannelSettings'; import { SET_ASSIGNED_FADER } from '../reducers/channelActions' import { TOGGLE_SHOW_OPTION } from '../reducers/settingsActions' -const { dialog } = require('electron').remote; interface IChannelSettingsInjectProps { label: string, @@ -52,7 +51,7 @@ class ChannelRouteSettings extends React.PureComponent { this.props.dispatch({ @@ -115,7 +114,7 @@ class ChannelRouteSettings extends React.PureComponent { if (this.props.channel.length > index) { diff --git a/src/components/Channels.tsx b/src/components/Channels.tsx index 2514acaa..2a238f28 100644 --- a/src/components/Channels.tsx +++ b/src/components/Channels.tsx @@ -23,7 +23,6 @@ import ChannelMonitorOptions from './ChannelMonitorOptions'; import { IChannels } from '../reducers/channelsReducer'; import { IFader } from '../reducers/fadersReducer'; import { ISettings } from '../reducers/settingsReducer'; -const { dialog } = require('electron').remote; interface IChannelsInjectProps { channels: IChannels @@ -103,7 +102,7 @@ class Channels extends React.Component { title: 'Save Current Setup', message: 'Stores the current state of Sisyfos - including Fader-Channel Routing', }; - let response = dialog.showSaveDialogSync(options) + let response = window.dialog.showSaveDialogSync(options) if (response === 'save') { console.log('SAVING CURRENT STATE') } @@ -115,7 +114,7 @@ class Channels extends React.Component { title: 'Load selected file', message: 'Loading Fader and Channels state', }; - let response = dialog.showOpenDialogSync(options) + let response = window.dialog.showOpenDialogSync(options) console.log('LOAD STATE? :', response) } diff --git a/src/components/RoutingStorage.tsx b/src/components/RoutingStorage.tsx index 9ef7c23e..0db70600 100644 --- a/src/components/RoutingStorage.tsx +++ b/src/components/RoutingStorage.tsx @@ -3,11 +3,10 @@ import React from 'react'; import '../assets/css/RoutingStorage.css'; import { Store } from 'redux'; import { connect } from 'react-redux'; -import * as fs from 'fs' -import * as electron from 'electron' import { TOGGLE_SHOW_STORAGE } from '../reducers/settingsActions' -const { dialog } = require('electron').remote; +// Node modules: +const fs = window.fs interface IStorageProps { load: any @@ -24,7 +23,7 @@ class Storage extends React.PureComponent { this.load = this.props.load this.save = this.props.save - this.path = electron.remote.app.getPath('userData'); + this.path = window.getPath('userData'); this.updateFilelist() @@ -55,7 +54,7 @@ class Storage extends React.PureComponent { title: 'Save Current Setup', message: 'Stores the current state of Sisyfos - including Fader-Channel Routing', }; - let response = dialog.showSaveDialogSync(options) + let response = window.dialog.showSaveDialogSync(options) if (response) { console.log('SAVING THIS FILE :', response) this.save(response) @@ -71,7 +70,7 @@ class Storage extends React.PureComponent { title: 'Load Routing', message: 'Load "' + event.target.textContent + '" Routing', }; - let response = dialog.showMessageBoxSync(options) + let response = window.dialog.showMessageBoxSync(options) if (!response) { console.log('Loading files') this.load(this.path + '/' + event.target.textContent, false) diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 76e3fb2e..1919507c 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import { connect } from "react-redux"; import Select from 'react-select'; -import WebMidi, { INoteParam, IMidiChannel } from 'webmidi'; +import WebMidi from 'webmidi'; import { IAppProps } from './App'; diff --git a/src/components/VuMeter.tsx b/src/components/VuMeter.tsx index 1365b0e8..0a431c3c 100644 --- a/src/components/VuMeter.tsx +++ b/src/components/VuMeter.tsx @@ -5,8 +5,7 @@ import { connect } from "react-redux"; import '../assets/css/VuMeter.css'; //Utils: import { MixerProtocolPresets } from '../constants/MixerProtocolPresets'; -import { IMixerProtocol, IMixerProtocolGeneric } from '../constants/MixerProtocolInterface'; -import { any } from 'prop-types'; +import { IMixerProtocolGeneric } from '../constants/MixerProtocolInterface'; export interface IVuMeterInjectedProps { showSnaps: boolean diff --git a/src/constants/mixerProtocols/EmberLawo.ts b/src/constants/mixerProtocols/EmberLawo.ts index 255c71ae..ba68823b 100644 --- a/src/constants/mixerProtocols/EmberLawo.ts +++ b/src/constants/mixerProtocols/EmberLawo.ts @@ -1,7 +1,7 @@ import { IMixerProtocol, emptyMixerMessage } from '../MixerProtocolInterface'; import path from 'path'; import os from 'os'; -import fs from 'fs'; +const fs = window.fs export const LawoClient: IMixerProtocol = { protocol: 'EMBER', diff --git a/src/constants/mixerProtocols/StuderVistaEmber.ts b/src/constants/mixerProtocols/StuderVistaEmber.ts index 9a786cf5..845aee5b 100644 --- a/src/constants/mixerProtocols/StuderVistaEmber.ts +++ b/src/constants/mixerProtocols/StuderVistaEmber.ts @@ -1,7 +1,7 @@ import { IMixerProtocol, emptyMixerMessage } from '../MixerProtocolInterface'; import path from 'path'; import os from 'os'; -import fs from 'fs'; +const fs = window.fs export const StuderVistaMaster: IMixerProtocol = { protocol: 'EMBER', diff --git a/src/constants/mixerProtocols/casparCGMaster.ts b/src/constants/mixerProtocols/casparCGMaster.ts index 874e36cb..e1b6eca9 100644 --- a/src/constants/mixerProtocols/casparCGMaster.ts +++ b/src/constants/mixerProtocols/casparCGMaster.ts @@ -1,5 +1,5 @@ import { ICasparCGMixerGeometry, ICasparCGMixerGeometryFile, emptyMixerMessage } from '../MixerProtocolInterface'; -import * as fs from 'fs'; +const fs = window.fs import * as os from 'os'; import * as path from 'path'; diff --git a/src/index.ejs b/src/index.ejs new file mode 100644 index 00000000..0d8ebc8a --- /dev/null +++ b/src/index.ejs @@ -0,0 +1,11 @@ + + + + + + SISYFOS INTELLIGENT AUDIO CONTROLLER + + + + + \ No newline at end of file diff --git a/src/index.tsx b/src/index.tsx index bf062b2b..59d5cd38 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -11,12 +11,20 @@ import { UPDATE_SETTINGS } from './reducers/settingsActions' //Utils: import { loadSettings } from './utils/SettingsStorage'; + declare global { interface Window { storeRedux: any mixerGenericConnection: any automationConnection: any huiRemoteConnection: any + fs: any + osc: any + net: any + emberplus: any + casparcgconnection: any + dialog: any + getPath: any } } diff --git a/src/utils/AutomationConnection.ts b/src/utils/AutomationConnection.ts index 1bbadeda..0ce7f97b 100644 --- a/src/utils/AutomationConnection.ts +++ b/src/utils/AutomationConnection.ts @@ -1,6 +1,5 @@ //Node Modules: -import os from 'os'; // Used to display (log) network addresses on local machine -import osc from 'osc'; //Using OSC fork from PieceMeta/osc.js as it has excluded hardware serialport support and thereby is crossplatform +const osc = window.osc //Utils: import { IAutomationProtocol, AutomationPresets } from '../constants/AutomationPresets'; diff --git a/src/utils/CasparCGConnection.ts b/src/utils/CasparCGConnection.ts index 92cd9c50..361e599e 100644 --- a/src/utils/CasparCGConnection.ts +++ b/src/utils/CasparCGConnection.ts @@ -1,11 +1,9 @@ //Node Modules: -import * as os from 'os'; // Used to display (log) network addresses on local machine -import { CasparCG } from 'casparcg-connection'; -import * as osc from 'osc'; +const osc = window.osc +const CasparCG = window.casparcgconnection //Utils: -import { MixerProtocolPresets } from '../constants/MixerProtocolPresets'; -import { IMixerProtocol, ICasparCGMixerGeometry, ICasparCGChannelLayerPair } from '../constants/MixerProtocolInterface'; +import { ICasparCGMixerGeometry, ICasparCGChannelLayerPair } from '../constants/MixerProtocolInterface'; import { IStore } from '../reducers/indexReducer'; import { IChannel } from '../reducers/channelsReducer'; import { SET_PRIVATE } from '../reducers/channelActions' @@ -27,8 +25,8 @@ const OSC_PATH_PRODUCER_CHANNEL_LAYOUT = /\/channel\/(\d+)\/stage\/layer\/(\d+)\ export class CasparCGConnection { store: IStore; mixerProtocol: ICasparCGMixerGeometry; - connection: CasparCG; - oscClient: osc.UDPPort | undefined; + connection: any; + oscClient: any; oscCommandMap: { [key: string]: CommandChannelMap } = {}; constructor(mixerProtocol: ICasparCGMixerGeometry) { @@ -74,7 +72,7 @@ export class CasparCGConnection { .on('ready', () => { console.log("Receiving state of mixer"); }) - .on('message', (message: osc.OSCMessage) => { + .on('message', (message: any) => { const index = this.checkOscCommand(message.address, this.oscCommandMap.CHANNEL_VU) if (index !== undefined && message.args) { window.storeRedux.dispatch({ @@ -178,7 +176,7 @@ export class CasparCGConnection { private syncCommand = Promise.resolve() controlVolume = (channel: number, layer: number, value: number) => { this.syncCommand = this.syncCommand.then(() => - this.connection.mixerVolume(channel, layer, value, 0, undefined).catch((e) => { + this.connection.mixerVolume(channel, layer, value, 0, undefined).catch((e: any) => { console.error('Failed to send command', e); }) ).then(() => { }) @@ -221,7 +219,7 @@ export class CasparCGConnection { return Promise.reject('Unknown operation'); }).then(() => { - }).catch((e) => { + }).catch((e: any) => { console.error('Failed to change channel setting', e); }) } diff --git a/src/utils/EmberMixerConnection.ts b/src/utils/EmberMixerConnection.ts index 85ed44dc..b1b3e439 100644 --- a/src/utils/EmberMixerConnection.ts +++ b/src/utils/EmberMixerConnection.ts @@ -1,10 +1,10 @@ -import { DeviceTree, QualifiedParameter } from 'emberplus'; +import { remote } from 'electron' +const DeviceTree = window.emberplus //Utils: import { IMixerProtocol } from '../constants/MixerProtocolInterface'; import { IStore } from '../reducers/indexReducer'; import { - SET_VU_LEVEL, SET_FADER_LEVEL, SET_CHANNEL_LABEL } from '../reducers/faderActions' diff --git a/src/utils/HuiMidiRemoteConnection.ts b/src/utils/HuiMidiRemoteConnection.ts index b5d6d5e3..aef3bade 100644 --- a/src/utils/HuiMidiRemoteConnection.ts +++ b/src/utils/HuiMidiRemoteConnection.ts @@ -1,6 +1,5 @@ //Node Modules: -import os from 'os'; // Used to display (log) network addresses on local machine -import WebMidi, { INoteParam, IMidiChannel } from 'webmidi'; +import WebMidi from 'webmidi'; import { SET_FADER_LEVEL, TOGGLE_PGM, @@ -10,10 +9,8 @@ import { //Utils: import { IRemoteProtocol, RemoteFaderPresets, - IMidiSendMessage, - MidiSendTypes, - IMidiReceiveMessage, - MidiReceiveTypes } from '../constants/RemoteFaderPresets'; + MidiReceiveTypes +} from '../constants/RemoteFaderPresets'; import { MixerProtocolPresets } from '../constants/MixerProtocolPresets'; export class HuiMidiRemoteConnection { diff --git a/src/utils/MidiMixerConnection.ts b/src/utils/MidiMixerConnection.ts index a8f8b102..1151e4c8 100644 --- a/src/utils/MidiMixerConnection.ts +++ b/src/utils/MidiMixerConnection.ts @@ -1,6 +1,5 @@ //Node Modules: -import * as os from 'os'; // Used to display (log) network addresses on local machine -import WebMidi, { INoteParam, IMidiChannel } from 'webmidi'; +import WebMidi from 'webmidi'; //Utils: import { MixerProtocolPresets } from '../constants/MixerProtocolPresets'; diff --git a/src/utils/OscMixerConnection.ts b/src/utils/OscMixerConnection.ts index 21f20ee4..87375510 100644 --- a/src/utils/OscMixerConnection.ts +++ b/src/utils/OscMixerConnection.ts @@ -1,6 +1,5 @@ //Node Modules: -import * as os from 'os'; // Used to display (log) network addresses on local machine -import * as osc from 'osc'; //Using OSC fork from PieceMeta/osc.js as it has excluded hardware serialport support and thereby is crossplatform +const osc = window.osc //Utils: import { IMixerProtocol } from '../constants/MixerProtocolInterface'; diff --git a/src/utils/QlClMixerConnection.ts b/src/utils/QlClMixerConnection.ts index 8ad3c0c8..4ed7b6cc 100644 --- a/src/utils/QlClMixerConnection.ts +++ b/src/utils/QlClMixerConnection.ts @@ -1,6 +1,5 @@ //Node Modules: -import * as os from 'os'; // Used to display (log) network addresses on local machine -import * as net from 'net' +const net = window.net //Utils: import { IMixerProtocol } from '../constants/MixerProtocolInterface' diff --git a/src/utils/SSLMixerConnection.ts b/src/utils/SSLMixerConnection.ts index 10560333..c0e9e8b5 100644 --- a/src/utils/SSLMixerConnection.ts +++ b/src/utils/SSLMixerConnection.ts @@ -1,5 +1,5 @@ //Node Modules: -import * as net from 'net' +const net = window.net //Utils: import { IMixerProtocol } from '../constants/MixerProtocolInterface' diff --git a/src/utils/SettingsStorage.ts b/src/utils/SettingsStorage.ts index 1e4dce6c..79a0d08c 100644 --- a/src/utils/SettingsStorage.ts +++ b/src/utils/SettingsStorage.ts @@ -1,7 +1,9 @@ +// Node Modules: +import { remote } from 'electron' +const fs = window.fs +const folder = window.getPath('userData'); -const fs = require('fs'); -const electron = require('electron'); -const folder = electron.remote.app.getPath('userData'); +// Redux: import { SET_COMPLETE_CH_STATE } from '../reducers/channelActions' import { SET_COMPLETE_FADER_STATE } from '../reducers/faderActions' diff --git a/tsconfig.json b/tsconfig.json index 97c69482..5e401b8c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,5 +23,10 @@ }, "include": [ "src" + ], + "exclude": [ + "node_modules", + "**/node_modules/*", + "dist" ] } diff --git a/webpack.build.config.js b/webpack.build.config.js index adc20b9c..846bb345 100644 --- a/webpack.build.config.js +++ b/webpack.build.config.js @@ -1,8 +1,6 @@ const webpack = require('webpack') const path = require('path') const HtmlWebpackPlugin = require('html-webpack-plugin') -const BabiliPlugin = require('babili-webpack-plugin') -const MiniCssExtractPlugin = require('mini-css-extract-plugin') // Any directories you will be adding code/files into, need to be added to this array so webpack will pick them up const defaultInclude = path.resolve(__dirname, 'src') @@ -11,13 +9,8 @@ module.exports = { module: { rules: [ { - test: /\.css$/, - use: [ - { loader: 'style-loader' }, - { loader: 'css-loader' }, - { loader: 'postcss-loader' } - ], - include: defaultInclude + test:/\.css$/, + use:['style-loader', 'css-loader'] }, { test: /\.(tsx?|ts)$/, diff --git a/webpack.dev.config.js b/webpack.dev.config.js index 3d787ad6..08d0beb3 100644 --- a/webpack.dev.config.js +++ b/webpack.dev.config.js @@ -10,17 +10,14 @@ module.exports = { module: { rules: [ { - test: /\.css$/, - use: [ - { loader: 'style-loader' }, - { loader: 'css-loader' }, - { loader: 'postcss-loader' } - ], - include: defaultInclude + test:/\.css$/, + use:['style-loader', 'css-loader'] }, { test: /\.(tsx?|ts)$/, - use: [{ loader: 'babel-loader' }], + use: [ + { loader: 'babel-loader' } + ], include: defaultInclude }, { @@ -38,16 +35,17 @@ module.exports = { resolve: { extensions: [ '.tsx', '.ts', '.js' ] }, - target: 'electron-renderer', + target: 'web', plugins: [ new HtmlWebpackPlugin({ - title: 'Sisyfos Audio Controller' + template: './src/index.ejs', + inject: true }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development') }) ], - devtool: 'cheap-source-map', + devtool: 'inline-source-map', devServer: { contentBase: path.resolve(__dirname, 'dist'), stats: { @@ -64,5 +62,8 @@ module.exports = { .on('close', code => process.exit(0)) .on('error', spawnError => console.error(spawnError)) } - } + }, + externals: { + fs: require("fs"), + }, }