Skip to content

Commit

Permalink
fix: do not run unwanted plugins in dev mode
Browse files Browse the repository at this point in the history
Signed-off-by: skjnldsv <[email protected]>
  • Loading branch information
skjnldsv committed Aug 8, 2024
1 parent 5d0c00a commit abd6e8f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
5 changes: 0 additions & 5 deletions src/store/folders.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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],
}
Expand Down
44 changes: 24 additions & 20 deletions webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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

0 comments on commit abd6e8f

Please sign in to comment.