From abd6e8f52e2c04fa9ac4fa52f99f570ad652e617 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Thu, 8 Aug 2024 09:47:40 +0200 Subject: [PATCH] fix: do not run unwanted plugins in dev mode Signed-off-by: skjnldsv --- src/store/folders.js | 5 ----- webpack.js | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/store/folders.js b/src/store/folders.js index 0d92b7eb8..efcf4f5da 100644 --- a/src/store/folders.js +++ b/src/store/folders.js @@ -20,10 +20,6 @@ const mutations = { * @param {Array} data.files list of files */ updateFolders(state, { fileid, files }) { - if (!state.folders[fileid]) { - Vue.set(state.folders, fileid, []) - } - if (files.length > 0) { // sort by last modified const list = files @@ -73,7 +69,6 @@ const mutations = { const getters = { folders: state => state.folders, - paths: state => state.paths, folder: state => fileid => state.folders[fileid], folderId: state => path => state.paths[path], } diff --git a/webpack.js b/webpack.js index e5c68af6e..97bc99eab 100644 --- a/webpack.js +++ b/webpack.js @@ -11,6 +11,8 @@ const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-m const WorkboxPlugin = require('workbox-webpack-plugin') const { basename } = require('path') +const isDev = process.env.NODE_ENV === 'development' + webpackConfig.entry = { main: path.join(__dirname, 'src', 'main.js'), public: path.join(__dirname, 'src', 'public.js'), @@ -89,27 +91,29 @@ webpackConfig.plugins.push( }) ) -// block creation of LICENSE.txt files now replaced with .license files -webpackConfig.optimization.minimizer = [new TerserPlugin({ - extractComments: false, - terserOptions: { - format: { - comments: false, +if (!isDev) { + // block creation of LICENSE.txt files now replaced with .license files + webpackConfig.optimization.minimizer = [new TerserPlugin({ + extractComments: false, + terserOptions: { + format: { + comments: false, + }, }, - }, -})] + })] -webpackConfig.plugins = [ - ...webpackConfig.plugins, - // Generate reuse license files - new WebpackSPDXPlugin({ - override: { - // TODO: Remove if they fixed the license in the package.json - '@nextcloud/axios': 'GPL-3.0-or-later', - '@nextcloud/vue': 'AGPL-3.0-or-later', - 'nextcloud-vue-collections': 'AGPL-3.0-or-later', - } - }), -] + webpackConfig.plugins = [ + ...webpackConfig.plugins, + // Generate reuse license files + new WebpackSPDXPlugin({ + override: { + // TODO: Remove if they fixed the license in the package.json + '@nextcloud/axios': 'GPL-3.0-or-later', + '@nextcloud/vue': 'AGPL-3.0-or-later', + 'nextcloud-vue-collections': 'AGPL-3.0-or-later', + } + }), + ] +} module.exports = webpackConfig