diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index 3db4faf5f5..b50cc99dca 100644 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -42,7 +42,7 @@ $eventDispatcher = \OC::$server->getEventDispatcher(); $eventDispatcher->addListener( 'OCA\Files::loadAdditionalScripts', function() { - \OCP\Util::addScript('files_sharing', 'additionalScripts'); + \OCP\Util::addScript('files_sharing', 'dist/additionalScripts'); } ); diff --git a/apps/files_sharing/src/additionalScripts.js b/apps/files_sharing/src/additionalScripts.js index dc07e2e933..081519cc64 100644 --- a/apps/files_sharing/src/additionalScripts.js +++ b/apps/files_sharing/src/additionalScripts.js @@ -1,6 +1,29 @@ +__webpack_public_path__ = OC.linkTo('files_sharing', 'js/'); +__webpack_nonce__ = btoa(OC.requestToken); + import './share' import './sharetabview' import './sharebreadcrumbview' import './style/sharetabview.scss' import './style/sharebreadcrumb.scss' + +window.OCP.Collaboration.registerType('files', { + action: () => { + return new Promise((resolve, reject) => { + OC.dialogs.filepicker('Link to a file', function (f) { + const client = OC.Files.getClient(); + client.getFileInfo(f).then((status, fileInfo) => { + resolve(fileInfo.id); + }, () => { + reject(); + }); + }, false); + }); + }, + /** used in "Link to a {typeString}" */ + typeString: t('files_sharing', 'file'), + typeIconClass: 'icon-files-dark' +}); + +window.OCA.Sharing = OCA.Sharing; diff --git a/apps/files_sharing/src/files_sharing.js b/apps/files_sharing/src/files_sharing.js index 54bf71d8a1..631dc3a832 100644 --- a/apps/files_sharing/src/files_sharing.js +++ b/apps/files_sharing/src/files_sharing.js @@ -1,29 +1,5 @@ - __webpack_nonce__ = btoa(OC.requestToken); -__webpack_public_path__ = OC.linkTo('files_sharing', 'js/dist/'); +__webpack_public_path__ = OC.linkTo('files_sharing', 'js/'); import '../js/app'; import '../js/sharedfilelist'; -import '../js/sharetabview'; -import '../js/share'; -import '../js/sharebreadcrumbview'; - -window.OCP.Collaboration.registerType('files', { - action: () => { - return new Promise((resolve, reject) => { - OC.dialogs.filepicker('Link to a file', function (f) { - const client = OC.Files.getClient(); - client.getFileInfo(f).then((status, fileInfo) => { - resolve(fileInfo.id); - }, () => { - reject(); - }); - }, false); - }); - }, - /** used in "Link to a {typeString}" */ - typeString: t('files_sharing', 'file'), - typeIconClass: 'icon-files-dark' -}); - -window.OCA.Sharing = OCA.Sharing; diff --git a/apps/files_sharing/src/sharetabview.js b/apps/files_sharing/src/sharetabview.js index eaed674775..275a79198c 100644 --- a/apps/files_sharing/src/sharetabview.js +++ b/apps/files_sharing/src/sharetabview.js @@ -83,7 +83,7 @@ self.trigger('sharesChanged', shareModel); }); - import('./../src/collaborationresources').then((Resources) => { + import('./collaborationresources').then((Resources) => { var vm = new Resources.Vue({ el: '#collaborationResources', render: h => h(Resources.View), diff --git a/apps/files_sharing/webpack.common.js b/apps/files_sharing/webpack.common.js deleted file mode 100644 index 9479459286..0000000000 --- a/apps/files_sharing/webpack.common.js +++ /dev/null @@ -1,47 +0,0 @@ -const path = require('path'); -const { VueLoaderPlugin } = require('vue-loader'); - -module.exports = { - entry: path.join(__dirname, 'src', 'files_sharing.js'), - output: { - path: path.resolve(__dirname, 'js/dist'), - publicPath: '/js/dist/', - filename: 'files_sharing.js', - chunkFilename: 'files_sharing.[name].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.runtime.esm.js', - }, - extensions: ['*', '.js', '.vue', '.json'] - } -}; diff --git a/apps/files_sharing/webpack.dev.js b/apps/files_sharing/webpack.dev.js deleted file mode 100644 index 0c569e7f61..0000000000 --- a/apps/files_sharing/webpack.dev.js +++ /dev/null @@ -1,12 +0,0 @@ -const merge = require('webpack-merge'); -const common = require('./webpack.common.js'); - -module.exports = merge(common, { - mode: 'development', - devServer: { - historyApiFallback: true, - noInfo: true, - overlay: true - }, - devtool: '#source-map', -}) diff --git a/apps/files_sharing/webpack.js b/apps/files_sharing/webpack.js index 815f6bd745..aedc73706d 100644 --- a/apps/files_sharing/webpack.js +++ b/apps/files_sharing/webpack.js @@ -1,26 +1,39 @@ const path = require('path'); +const { VueLoaderPlugin } = require('vue-loader'); module.exports = { - entry: path.join(__dirname, 'src', 'additionalScripts.js'), + entry: { + 'additionalScripts': path.join(__dirname, 'src', 'additionalScripts.js'), + 'files_sharing': path.join(__dirname, 'src', 'files_sharing.js'), +}, output: { - path: path.resolve(__dirname, './js'), + path: path.resolve(__dirname, './js/dist/'), publicPath: '/js/', - filename: 'additionalScripts.js' + filename: '[name].js', + chunkFilename: 'files_sharing.[id].js' + }, module: { rules: [ { test: /\.css$/, - use: ['style-loader', 'css-loader'] + use: ['vue-style-loader', 'css-loader'] }, { test: /\.scss$/, - use: ['style-loader', 'css-loader', 'sass-loader'] + use: ['vue-style-loader', 'css-loader', 'sass-loader'] + }, + { + test: /\.vue$/, + loader: 'vue-loader' }, { test: /\.js$/, loader: 'babel-loader', - exclude: /node_modules/ + exclude: /node_modules/, + options: { + plugins: ['@babel/plugin-syntax-dynamic-import'] + } }, { test: /\.(png|jpg|gif|svg)$/, @@ -31,7 +44,11 @@ module.exports = { } ] }, + plugins: [new VueLoaderPlugin()], resolve: { - extensions: ['*', '.js'] + alias: { + vue$: 'vue/dist/vue.runtime.esm.js', + }, + extensions: ['*', '.js', '.vue', '.json'] } }; diff --git a/apps/files_sharing/webpack.prod.js b/apps/files_sharing/webpack.prod.js deleted file mode 100644 index f081567bd6..0000000000 --- a/apps/files_sharing/webpack.prod.js +++ /dev/null @@ -1,7 +0,0 @@ -const merge = require('webpack-merge') -const common = require('./webpack.common.js') - -module.exports = merge(common, { - mode: 'production', - devtool: '#source-map' -})