From b7f5ca9da696390786545e1d4242597d0226806b Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Tue, 26 May 2020 09:37:44 +0200 Subject: [PATCH] Don't use webpack to transpile ts into js for frontend --- frontend/config.json | 7 +++---- frontend/ts/index.ts | 1 - frontend/ts/service-settings.ts | 1 - package.json | 6 +++--- webpack.config.js | 11 ++++++++--- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/frontend/config.json b/frontend/config.json index 0f64ec2..87e1488 100644 --- a/frontend/config.json +++ b/frontend/config.json @@ -1,9 +1,8 @@ { "bundles": { - "index": "ts/index.ts", - "settings": "ts/settings.ts", - "service-settings": "ts/service-settings.ts", + "files": "ts/files.ts", "layout": "sass/layout.scss", - "files": "ts/files.ts" + "index": "sass/index.scss", + "service-settings": "sass/service-settings.scss" } } \ No newline at end of file diff --git a/frontend/ts/index.ts b/frontend/ts/index.ts index 38095bd..5b499a6 100644 --- a/frontend/ts/index.ts +++ b/frontend/ts/index.ts @@ -7,7 +7,6 @@ import { UpdateTargetUrlEvent, WebContents } from "electron"; -import "../sass/index.scss"; const { Menu, diff --git a/frontend/ts/service-settings.ts b/frontend/ts/service-settings.ts index c4b2f51..5b0ed7c 100644 --- a/frontend/ts/service-settings.ts +++ b/frontend/ts/service-settings.ts @@ -1,5 +1,4 @@ import {ipcRenderer, remote} from "electron"; -import "../sass/service-settings.scss"; let isImageCheckbox: HTMLInputElement | null; let builtInIconSearchField: HTMLInputElement | null; diff --git a/package.json b/package.json index ad45a90..c9f96e1 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "main": "build/main.js", "scripts": { "clean": "(! test -d build || rm -r build) && (! test -d resources || rm -r resources)", - "compile": "yarn clean && tsc -p tsconfig.backend.json && webpack --mode production", - "compile-dev": "yarn clean && tsc -p tsconfig.backend.json && webpack --mode development", + "compile": "yarn clean && tsc -p tsconfig.backend.json && tsc -p tsconfig.frontend.json && webpack --mode production", + "compile-dev": "yarn clean && tsc -p tsconfig.backend.json && tsc -p tsconfig.frontend.json && webpack --mode development", "start": "yarn compile && electron .", - "dev": "yarn compile-dev && concurrently -k -n \"Electron,Webpack\" -p \"[{name}]\" -c \"green,yellow\" \"electron . --dev\" \"webpack --mode development --watch\"", + "dev": "yarn compile-dev && concurrently -k -n \"Electron,Webpack,TSC-Frontend\" -p \"[{name}]\" -c \"green,yellow\" \"electron . --dev\" \"webpack --mode development --watch\" \"tsc -p tsconfig.frontend.json --watch\"", "build": "yarn compile && electron-builder -wl", "release": "yarn compile && GH_TOKEN=$(cat GH_TOKEN) electron-builder -wlp always" }, diff --git a/webpack.config.js b/webpack.config.js index 1780838..8c4b7cf 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -14,7 +14,7 @@ for (const b in userConfig.bundles) { const config = { entry: userConfig.bundles, output: { - path: path.resolve(__dirname, 'resources/js'), + path: path.resolve(__dirname, 'resources/useless-js'), // Temporary until webpack stops emitting js for css files filename: '[name].js' }, devtool: dev ? 'eval-source-map' : undefined, @@ -69,8 +69,13 @@ const config = { }, { test: /\.ts$/i, - use: 'ts-loader', - exclude: '/node_modules/', + use: { + loader: 'ts-loader', + options: { + configFile: 'tsconfig.frontend.json', + } + }, + exclude: '/node_modules/' }, { test: /\.html$/i,