-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.js
41 lines (32 loc) · 1020 Bytes
/
webpack.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
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 isTesting = !!process.env.TESTING
if (isTesting) {
console.debug('TESTING MODE ENABLED')
}
// vue-plyr uses .mjs file
webpackRules.RULE_JS.test = /\.m?js$/
webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([
'camelcase',
'fast-xml-parser',
'hot-patcher',
'semver',
'vue-plyr',
'webdav',
'toastify-js',
])
// Replaces rules array
webpackConfig.module.rules = Object.values(webpackRules)
webpackConfig.entry.main = path.resolve(path.join('src', 'main.js'))
webpackConfig.entry.toolbar = path.resolve(path.join('src', 'toolbar.js'))
// Add custom plugins
webpackConfig.plugins.push(...[
new webpack.DefinePlugin({
isTesting,
}),
])
module.exports = webpackConfig