forked from nextcloud/richdocuments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.js
35 lines (28 loc) · 1.04 KB
/
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
const path = require('path')
const webpackConfig = require('@nextcloud/webpack-vue-config')
const webpackRules = require('@nextcloud/webpack-vue-config/rules')
const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
webpackConfig.entry = {
viewer: path.join(__dirname, 'src', 'viewer.js'),
files: path.join(__dirname, 'src', 'files.js'),
document: path.join(__dirname, 'src', 'document.js'),
admin: path.join(__dirname, 'src', 'admin.js'),
personal: path.join(__dirname, 'src', 'personal.js'),
}
webpackRules.RULE_JS.test = /\.m?js$/
webpackRules.RULE_JS.exclude = BabelLoaderExcludeNodeModulesExcept([
'@nextcloud/dialogs',
'@nextcloud/event-bus'
])
// Replaces rules array
webpackConfig.module.rules = Object.values(webpackRules)
// Add typescript rule
webpackConfig.module.rules.push({
test: /\.tsx?$/,
use: ['babel-loader', 'ts-loader'],
exclude: /node_modules/
})
// Add typescript extension resolver
webpackConfig.resolve.extensions.push('.tsx')
// Export final config
module.exports = webpackConfig