2023-04-21 06:07:09 +00:00
|
|
|
const webpackConfig = require('@nextcloud/webpack-vue-config');
|
|
|
|
const WorkboxPlugin = require('workbox-webpack-plugin');
|
|
|
|
const path = require('path');
|
|
|
|
const TerserPlugin = require('terser-webpack-plugin');
|
2022-09-13 01:33:24 +00:00
|
|
|
|
2023-04-21 06:07:09 +00:00
|
|
|
const buildMode = process.env.NODE_ENV;
|
|
|
|
const isDev = buildMode === 'development';
|
2022-10-17 02:52:44 +00:00
|
|
|
|
2022-09-13 01:33:24 +00:00
|
|
|
webpackConfig.module.rules.push({
|
2023-04-21 06:07:09 +00:00
|
|
|
test: /\.ts?$/,
|
|
|
|
loader: 'ts-loader',
|
|
|
|
exclude: /node_modules/,
|
|
|
|
options: {
|
|
|
|
appendTsSuffixTo: [/\.vue$/],
|
|
|
|
},
|
2022-09-13 01:33:24 +00:00
|
|
|
});
|
|
|
|
webpackConfig.resolve.extensions.push('.ts');
|
|
|
|
webpackConfig.resolve.alias = {
|
2023-04-21 06:07:09 +00:00
|
|
|
vue$: 'vue/dist/vue.esm.js',
|
|
|
|
};
|
2022-09-13 01:33:24 +00:00
|
|
|
webpackConfig.entry.main = path.resolve(path.join('src', 'main'));
|
2022-08-14 20:54:18 +00:00
|
|
|
|
2022-10-15 19:21:53 +00:00
|
|
|
webpackConfig.watchOptions = {
|
2023-04-21 06:07:09 +00:00
|
|
|
ignored: /node_modules/,
|
|
|
|
aggregateTimeout: 300,
|
2022-10-15 19:21:53 +00:00
|
|
|
};
|
|
|
|
|
2022-12-07 20:25:19 +00:00
|
|
|
webpackConfig.plugins.push(
|
2023-04-21 06:07:09 +00:00
|
|
|
new WorkboxPlugin.InjectManifest({
|
|
|
|
swSrc: path.resolve(path.join('src', 'service-worker.js')),
|
|
|
|
swDest: 'memories-service-worker.js',
|
|
|
|
})
|
2022-12-07 20:25:19 +00:00
|
|
|
);
|
2022-10-17 02:52:44 +00:00
|
|
|
|
2023-04-17 05:28:56 +00:00
|
|
|
// Exclusions from minification
|
2023-04-21 06:07:09 +00:00
|
|
|
const minifyExclude = [/filerobot-image-editor/];
|
2023-04-17 05:28:56 +00:00
|
|
|
|
2023-04-21 06:07:09 +00:00
|
|
|
webpackConfig.optimization.minimizer[0] = new TerserPlugin({
|
|
|
|
exclude: minifyExclude,
|
|
|
|
terserOptions: {
|
|
|
|
output: {
|
|
|
|
comments: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
extractComments: true,
|
|
|
|
});
|
2023-04-17 05:28:56 +00:00
|
|
|
|
2023-04-21 06:07:24 +00:00
|
|
|
// Disable source maps in production
|
|
|
|
webpackConfig.devtool = isDev ? 'cheap-source-map' : false;
|
|
|
|
|
2023-04-21 06:07:09 +00:00
|
|
|
module.exports = webpackConfig;
|