From 62cc1f73ca6f5649361fafd81b6ba20e0c93d96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 12 May 2021 15:57:53 +0200 Subject: [PATCH] Tryig to fix webpack for Svelte --- front/src/Components/Menu/MenuIcon.svelte | 0 .../Stores/RequestedConstraintsStore.ts | 22 +++++++++++++++++++ front/webpack.config.ts | 9 ++++---- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 front/src/Components/Menu/MenuIcon.svelte create mode 100644 front/src/WebRtc/Stores/RequestedConstraintsStore.ts diff --git a/front/src/Components/Menu/MenuIcon.svelte b/front/src/Components/Menu/MenuIcon.svelte new file mode 100644 index 00000000..e69de29b diff --git a/front/src/WebRtc/Stores/RequestedConstraintsStore.ts b/front/src/WebRtc/Stores/RequestedConstraintsStore.ts new file mode 100644 index 00000000..3e2243e3 --- /dev/null +++ b/front/src/WebRtc/Stores/RequestedConstraintsStore.ts @@ -0,0 +1,22 @@ +import { derived, writable, Writable } from "svelte/store"; + +class RequestedConstraintsStore { + constructor( + public camera: Writable = writable(false), + public microphone: Writable = writable(false), + ) { } + + get fullname() { + // Use derived to access writable values and export as readonly + return derived( + [this.camera, this.microphone], + ([$camera, $microphone]) => { + console.log("cam or mic", $camera || $microphone) + return $camera || $microphone; + } + ) + } +} + +// Export a singleton +export const myFormStore = new MyFormStore(); diff --git a/front/webpack.config.ts b/front/webpack.config.ts index e5d3f9e8..4fae3cff 100644 --- a/front/webpack.config.ts +++ b/front/webpack.config.ts @@ -44,7 +44,7 @@ module.exports = { use: [MiniCssExtractPlugin.loader, 'css-loader?url=false', 'sass-loader'], }, { - test: /\.svelte$/, + test: /\.(html|svelte)$/, exclude: /node_modules/, use: { loader: 'svelte-loader', @@ -85,12 +85,11 @@ module.exports = { ], }, resolve: { - /*alias: { - // Note: Later in this config file, we'll automatically add paths from `tsconfig.compilerOptions.paths` + alias: { svelte: path.resolve('node_modules', 'svelte') - },*/ + }, extensions: [ '.tsx', '.ts', '.js', '.svelte' ], - //mainFields: ['svelte', 'browser', 'module', 'main'] + mainFields: ['svelte', 'browser', 'module', 'main'] }, output: { filename: (pathData) => {