Browse Source

convert electron main to js

- circumvent type error from redux middleware declaration
master
jeffvli 3 years ago
parent
commit
8e835b1d43
  1. 13
      .erb/configs/webpack.config.main.prod.babel.js
  2. 2
      package.json
  3. 6
      src/main.dev.js

13
.erb/configs/webpack.config.main.prod.babel.js

@ -14,9 +14,12 @@ import DeleteSourceMaps from '../scripts/DeleteSourceMaps';
CheckNodeEnv('production');
DeleteSourceMaps();
const devtoolsConfig = process.env.DEBUG_PROD === 'true' ? {
devtool: 'source-map'
} : {};
const devtoolsConfig =
process.env.DEBUG_PROD === 'true'
? {
devtool: 'source-map',
}
: {};
export default merge(baseConfig, {
...devtoolsConfig,
@ -25,7 +28,7 @@ export default merge(baseConfig, {
target: 'electron-main',
entry: './src/main.dev.ts',
entry: './src/main.dev.js',
output: {
path: path.join(__dirname, '../../'),
@ -37,7 +40,7 @@ export default merge(baseConfig, {
new TerserPlugin({
parallel: true,
}),
]
],
},
plugins: [

2
package.json

@ -11,7 +11,7 @@
"package": "rm -rf src/dist && yarn build && electron-builder build --publish never",
"postinstall": "node -r @babel/register .erb/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.babel.js && opencollective-postinstall && yarn-deduplicate yarn.lock",
"start": "node -r @babel/register ./.erb/scripts/CheckPortInUse.js && yarn start:renderer",
"start:main": "cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts",
"start:main": "cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.js",
"start:renderer": "cross-env NODE_ENV=development webpack serve --config ./.erb/configs/webpack.config.renderer.dev.babel.js",
"test": "jest"
},

6
src/main.dev.ts → src/main.dev.js

@ -28,7 +28,7 @@ import playQueueReducer, {
import multiSelectReducer from './redux/multiSelectSlice';
import MenuBuilder from './menu';
export const store = configureStore<any>({
export const store = configureStore({
reducer: {
player: playerReducer,
playQueue: playQueueReducer,
@ -47,7 +47,7 @@ export default class AppUpdater {
}
}
let mainWindow: BrowserWindow | null = null;
let mainWindow = null;
if (process.env.NODE_ENV === 'production') {
const sourceMapSupport = require('source-map-support');
@ -86,7 +86,7 @@ const createWindow = async () => {
? path.join(process.resourcesPath, 'assets')
: path.join(__dirname, '../assets');
const getAssetPath = (...paths: string[]): string => {
const getAssetPath = (...paths) => {
return path.join(RESOURCES_PATH, ...paths);
};
Loading…
Cancel
Save