Unify webpack config

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2019-05-24 14:08:39 +02:00
parent 21f9487939
commit b53a9130a6
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
16 changed files with 114 additions and 407 deletions

View file

@ -1,5 +1,4 @@
const path = require('path'); const path = require('path')
const { VueLoaderPlugin } = require('vue-loader');
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'main.js'), entry: path.join(__dirname, 'src', 'main.js'),
@ -7,22 +6,5 @@ module.exports = {
path: path.resolve(__dirname, './js'), path: path.resolve(__dirname, './js'),
publicPath: '/js/', publicPath: '/js/',
filename: 'accessibility.js' filename: 'accessibility.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
extensions: ['*', '.js', '.vue', '.json']
} }
}; }

View file

@ -1,4 +1,4 @@
const path = require('path'); const path = require('path')
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'comments.js'), entry: path.join(__dirname, 'src', 'comments.js'),
@ -7,34 +7,7 @@ module.exports = {
publicPath: '/js/', publicPath: '/js/',
filename: 'comments.js' filename: 'comments.js'
}, },
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
externals: { externals: {
jquery: 'jQuery' jquery: 'jQuery'
},
resolve: {
extensions: ['*', '.js']
} }
}; }

View file

@ -1,5 +1,4 @@
const path = require('path'); const path = require('path');
const { VueLoaderPlugin } = require('vue-loader');
module.exports = { module.exports = {
entry: { entry: {
@ -12,31 +11,5 @@ module.exports = {
publicPath: '/js/', publicPath: '/js/',
filename: '[name].js', filename: '[name].js',
chunkFilename: 'files_sharing.[id].js' chunkFilename: 'files_sharing.[id].js'
}
}, }
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
extensions: ['*', '.js', '.vue', '.json']
},
};

View file

@ -1,4 +1,4 @@
const path = require('path'); const path = require('path')
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'files_trashbin.js'), entry: path.join(__dirname, 'src', 'files_trashbin.js'),
@ -6,32 +6,5 @@ module.exports = {
path: path.resolve(__dirname, './js'), path: path.resolve(__dirname, './js'),
publicPath: '/js/', publicPath: '/js/',
filename: 'files_trashbin.js' filename: 'files_trashbin.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
extensions: ['*', '.js']
} }
}; }

View file

@ -1,4 +1,4 @@
const path = require('path'); const path = require('path')
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'files_versions.js'), entry: path.join(__dirname, 'src', 'files_versions.js'),
@ -6,36 +6,5 @@ module.exports = {
path: path.resolve(__dirname, 'js'), path: path.resolve(__dirname, 'js'),
publicPath: '/js/', publicPath: '/js/',
filename: 'files_versions.js' filename: 'files_versions.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{
test: /\.handlebars$/,
loader: "handlebars-loader"
}
]
},
resolve: {
extensions: ['*', '.js']
} }
}; }

View file

@ -1,32 +1,10 @@
const path = require('path') const path = require('path')
const { VueLoaderPlugin } = require('vue-loader');
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'main.js'), entry: path.join(__dirname, 'src', 'main.js'),
output: { output: {
path: path.resolve(__dirname, './js'), path: path.resolve(__dirname, './js'),
publicPath: '/js', publicPath: '/js',
filename: 'oauth2.js' filename: 'oauth2.js'
}, }
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
]
},
plugins: [
new VueLoaderPlugin()
],
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
}
} }

View file

@ -1,4 +1,4 @@
const path = require('path'); const path = require('path')
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'systemtags.js'), entry: path.join(__dirname, 'src', 'systemtags.js'),
@ -6,32 +6,5 @@ module.exports = {
path: path.resolve(__dirname, './js'), path: path.resolve(__dirname, './js'),
publicPath: '/js/', publicPath: '/js/',
filename: 'systemtags.js' filename: 'systemtags.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
resolve: {
extensions: ['*', '.js']
} }
}; }

View file

@ -1,5 +1,4 @@
const path = require('path'); const path = require('path')
const { VueLoaderPlugin } = require('vue-loader');
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'settings.js'), entry: path.join(__dirname, 'src', 'settings.js'),
@ -7,40 +6,5 @@ module.exports = {
path: path.resolve(__dirname, 'js'), path: path.resolve(__dirname, 'js'),
publicPath: '/js', publicPath: '/js',
filename: 'settings.js' filename: 'settings.js'
},
module: {
rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
alias: {
vue$: 'vue/dist/vue.esm.js',
},
extensions: ['*', '.js', '.vue', '.json']
} }
}; }

View file

@ -409,7 +409,7 @@
} }
</script> </script>
<style lang="sass" scoped> <style lang="scss" scoped>
#updatenotification { #updatenotification {
margin-top: -25px; margin-top: -25px;
margin-bottom: 200px; margin-bottom: 200px;
@ -482,7 +482,7 @@
} }
} }
</style> </style>
<style lang="sass"> <style lang="scss">
/* override needed to make menu wider */ /* override needed to make menu wider */
#updatenotification .popovermenu { #updatenotification .popovermenu {
p { p {

View file

@ -1,5 +1,4 @@
const path = require('path'); const path = require('path')
const { VueLoaderPlugin } = require('vue-loader');
module.exports = { module.exports = {
entry: path.join(__dirname, 'src', 'init.js'), entry: path.join(__dirname, 'src', 'init.js'),
@ -7,26 +6,5 @@ module.exports = {
path: path.resolve(__dirname, './js'), path: path.resolve(__dirname, './js'),
publicPath: '/js/', publicPath: '/js/',
filename: 'updatenotification.js' filename: 'updatenotification.js'
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.s[a|c]ss$/,
loader: 'style-loader!css-loader!sass-loader'
}
]
},
plugins: [new VueLoaderPlugin()],
resolve: {
extensions: ['*', '.js', '.vue', '.json']
} }
}; }

View file

@ -9,36 +9,13 @@ module.exports = {
}, },
module: { module: {
rules: [ rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{ {
test: /\.handlebars$/, test: /\.handlebars$/,
loader: "handlebars-loader", loader: "handlebars-loader",
options: { options: {
helperDirs: path.join(__dirname, 'src/hbs_helpers'), helperDirs: path.join(__dirname, 'src/hbs_helpers'),
} }
}, }
] ]
},
resolve: {
extensions: ['*', '.js', '.handlebars']
} }
}; }

View file

@ -1,6 +1,5 @@
const path = require('path'); const path = require('path')
const webpack = require('webpack'); const webpack = require('webpack')
const { VueLoaderPlugin } = require('vue-loader');
module.exports = [ module.exports = [
{ {
@ -15,41 +14,9 @@ module.exports = [
}, },
module: { module: {
rules: [ rules: [
{
test: /\.css$/,
use: ['vue-style-loader', 'style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['vue-style-loader', 'style-loader', 'css-loader', 'sass-loader']
},
{ {
test: /davclient/, test: /davclient/,
use: 'exports-loader?dav' use: 'exports-loader?dav'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]?[hash]',
limit: 8192
}
},
{
test: /\.handlebars/,
loader: "handlebars-loader",
query: {
extensions: '.handlebars'
}
} }
] ]
}, },
@ -58,16 +25,8 @@ module.exports = [
'_': "underscore", '_': "underscore",
$: "jquery", $: "jquery",
jQuery: "jquery" jQuery: "jquery"
}), })
new VueLoaderPlugin(), ]
],
resolve: {
alias: {
handlebars: 'handlebars/runtime'
},
extensions: ['*', '.js'],
symlinks: false
}
}, },
{ {
entry: { entry: {
@ -77,23 +36,6 @@ module.exports = [
output: { output: {
filename: '[name].js', filename: '[name].js',
path: path.resolve(__dirname, 'js/dist') path: path.resolve(__dirname, 'js/dist')
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
]
} }
} }
]; ]

View file

@ -1,5 +1,4 @@
const path = require('path') const path = require('path')
const { VueLoaderPlugin } = require('vue-loader');
module.exports = { module.exports = {
entry: { entry: {
@ -16,36 +15,5 @@ module.exports = {
splitChunks: { splitChunks: {
automaticNameDelimiter: '-', automaticNameDelimiter: '-',
} }
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader', 'css-loader'
],
},
{
test: /\.scss$/,
use: [
'vue-style-loader', 'css-loader', 'sass-loader'
],
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
]
},
plugins: [
new VueLoaderPlugin()
],
resolve: {
extensions: ['*', '.js', '.vue', '.json']
} }
} }

View file

@ -1,28 +1,85 @@
const core = require('./core/webpack') const path = require('path');
const settings = require('./settings/webpack') const merge = require('webpack-merge');
const { VueLoaderPlugin } = require('vue-loader');
const accessibility = require('./apps/accessibility/webpack') const core = require('./core/webpack');
const comments = require('./apps/comments/webpack') const settings = require('./settings/webpack');
const files_sharing = require('./apps/files_sharing/webpack')
const files_trashbin = require('./apps/files_trashbin/webpack')
const files_versions = require('./apps/files_versions/webpack')
const oauth2 = require('./apps/oauth2/webpack')
const systemtags = require('./apps/systemtags/webpack')
const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack')
const updatenotifications = require('./apps/updatenotification/webpack')
const workflowengine = require('./apps/workflowengine/webpack')
module.exports = [].concat( const accessibility = require('./apps/accessibility/webpack');
core, const comments = require('./apps/comments/webpack');
settings, const files_sharing = require('./apps/files_sharing/webpack');
accessibility, const files_trashbin = require('./apps/files_trashbin/webpack');
comments, const files_versions = require('./apps/files_versions/webpack');
files_sharing, const oauth2 = require('./apps/oauth2/webpack');
files_trashbin, const systemtags = require('./apps/systemtags/webpack');
files_versions, const twofactor_backupscodes = require('./apps/twofactor_backupcodes/webpack');
oauth2, const updatenotifications = require('./apps/updatenotification/webpack');
systemtags, const workflowengine = require('./apps/workflowengine/webpack');
twofactor_backupscodes,
updatenotifications, module.exports = []
workflowengine .concat(
); core,
settings,
accessibility,
comments,
files_sharing,
files_trashbin,
files_versions,
oauth2,
systemtags,
twofactor_backupscodes,
updatenotifications,
workflowengine
)
.map(config =>
merge(config, {
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader']
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]?[hash]',
limit: 8192
}
},
{
test: /\.handlebars/,
loader: "handlebars-loader",
query: {
extensions: '.handlebars'
}
}
]
},
plugins: [
new VueLoaderPlugin()
],
resolve: {
alias: {
OC: path.resolve(__dirname, './core/src/OC'),
OCA: path.resolve(__dirname, './core/src/OCA'),
// make sure to use the handlebar runtime when importing
handlebars: 'handlebars/runtime'
},
extensions: ['*', '.js', '.vue', '.json']
}
})
);