Move merged-share-backend to webpack

For #13608

Since we have webpack anyway it make sense to let webpack do the
bundling instead of ourselfs. This leads to minified code (so less
transfer). And the webserver can just handle the request.

As a bonus we get a map file so debugging is easier than with our
JSCombiner stuff.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-01-15 21:18:32 +01:00
parent b58f3e7583
commit c77d7d6e79
No known key found for this signature in database
GPG Key ID: F941078878347C0C
8 changed files with 113 additions and 66 deletions

24
core/js/dist/share_backend.js vendored Normal file

File diff suppressed because one or more lines are too long

1
core/js/dist/share_backend.js.map vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,9 @@
require('./shareconfigmodel.js')
require('./sharetemplates.js')
require('./shareitemmodel.js')
require('./sharesocialmanager.js')
require('./sharedialogresharerinfoview.js')
require('./sharedialoglinkshareview.js')
require('./sharedialogshareelistview.js')
require('./sharedialogview.js')
require('./share.js')

View File

@ -1,11 +0,0 @@
[
"shareconfigmodel.js",
"sharetemplates.js",
"shareitemmodel.js",
"sharesocialmanager.js",
"sharedialogresharerinfoview.js",
"sharedialoglinkshareview.js",
"sharedialogshareelistview.js",
"sharedialogview.js",
"share.js"
]

View File

@ -1,51 +1,71 @@
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
main: path.join(__dirname, 'src/main.js')
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'js/dist')
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /davclient/,
use: 'exports-loader?dav'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]?[hash]',
limit: 8192
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
'_': "underscore",
$: "jquery",
jQuery: "jquery"
})
],
resolve: {
alias: {
handlebars: 'handlebars/runtime'
module.exports = [
{
entry: {
main: path.join(__dirname, 'src/main.js'),
},
extensions: ['*', '.js'],
symlinks: false
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'js/dist')
},
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
},
{
test: /davclient/,
use: 'exports-loader?dav'
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif)$/,
loader: 'url-loader',
options: {
name: '[name].[ext]?[hash]',
limit: 8192
}
}
]
},
plugins: [
new webpack.ProvidePlugin({
'_': "underscore",
$: "jquery",
jQuery: "jquery"
})
],
resolve: {
alias: {
handlebars: 'handlebars/runtime'
},
extensions: ['*', '.js'],
symlinks: false
}
},
{
entry: {
share_backend: path.resolve(__dirname, 'js/merged-share-backend.js')
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'js/dist')
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
}
}
};
];

View File

@ -1,7 +1,9 @@
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
module.exports = merge(common, {
mode: 'development',
devtool: 'cheap-source-map',
})
module.exports = common.map(
config => merge(config, {
mode: 'development',
devtool: 'cheap-source-map',
})
)

View File

@ -1,7 +1,9 @@
const merge = require('webpack-merge')
const common = require('./webpack.common.js')
module.exports = merge(common, {
mode: 'production',
devtool: '#source-map'
})
module.exports = common.map(
config => merge(config, {
mode: 'production',
devtool: '#source-map',
})
)

View File

@ -85,7 +85,7 @@ class Share extends Constants {
'supportedFileExtensions' => $supportedFileExtensions
);
if(count(self::$backendTypes) === 1) {
Util::addScript('core', 'merged-share-backend');
Util::addScript('core', 'dist/share_backend');
}
return true;
}