diff options
author | dartcafe <github@dartcafe.de> | 2022-01-02 12:24:03 +0300 |
---|---|---|
committer | dartcafe <github@dartcafe.de> | 2022-01-02 12:31:29 +0300 |
commit | 9a3441c0acee6159be1ba8969df43191e11c3035 (patch) | |
tree | abbe8d154fe4934c66b02aca1f7e867538e5577c /webpack.config.js | |
parent | e864f3877d43be2043feb8d9575039afca75044c (diff) |
enable windows
Signed-off-by: dartcafe <github@dartcafe.de>
Diffstat (limited to 'webpack.config.js')
-rw-r--r-- | webpack.config.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..22ede038 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,73 @@ +const path = require('path') +const webpack = require('webpack') +const md5 = require('md5') + +const webpackConfig = require('@nextcloud/webpack-vue-config') +const webpackRules = require('@nextcloud/webpack-vue-config/rules') +const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except') +const IconfontPlugin = require('iconfont-plugin-webpack') + +const appVersion = JSON.stringify(process.env.npm_package_version) + +// Add dashboard entry +webpackConfig.entry.dashboard = path.join(__dirname, 'src', 'dashboard.js') + +// Add appointments entries +webpackConfig.entry['appointments-booking'] = path.join(__dirname, 'src', 'appointments/main-booking.js') +webpackConfig.entry['appointments-confirmation'] = path.join(__dirname, 'src', 'appointments/main-confirmation.js') +webpackConfig.entry['appointments-conflict'] = path.join(__dirname, 'src', 'appointments/main-conflict.js') +webpackConfig.entry['appointments-overview'] = path.join(__dirname, 'src', 'appointments/main-overview.js') + +// Edit JS rule +webpackRules.RULE_JS.test = /\.m?js$/ +webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([ + 'p-limit', + 'p-defer', + 'p-queue', + 'p-try', + 'yocto-queue', +]) + +// Edit SCSS rule +webpackRules.RULE_SCSS.use = [ + 'vue-style-loader', + 'css-loader', + 'resolve-url-loader', + { + loader: 'sass-loader', + options: { + // ! needed for resolve-url-loader + sourceMap: true, + sassOptions: { + sourceMapContents: false, + includePaths: [ + path.resolve(__dirname, './src/assets'), + ], + }, + }, + }, +], + +webpackConfig.plugins.push( + new IconfontPlugin({ + src: './src/assets/iconfont', + family: `iconfont-calendar-app-${md5(appVersion)}`, + dest: { + font: './src/fonts/[family].[type]', + css: './src/fonts/scss/iconfont-calendar-app.scss', + }, + watch: { + pattern: './src/assets/iconfont/*.svg', + }, + }), + new webpack.IgnorePlugin(/^\.\/locale(s)?$/, /(moment)$/), + new webpack.ProvidePlugin({ + // Shim ICAL to prevent using the global object (window.ICAL). + // The library ical.js heavily depends on instanceof checks which will + // break if two separate versions of the library are used (e.g. bundled one + // and global one). + ICAL: 'ical.js', + }), +) + +module.exports = webpackConfig |