diff options
| author | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:07:19 +0200 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2021-07-22 16:19:12 +0200 |
| commit | a3da1483a9e689846179159355badfec8073dbec (patch) | |
| tree | 770dcca6bdf5f6f2a11b0e7fcbbeda6919a3fc52 /webpack.common.js | |
current code from svn, revision 62608
Diffstat (limited to 'webpack.common.js')
| -rw-r--r-- | webpack.common.js | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/webpack.common.js b/webpack.common.js new file mode 100644 index 0000000..9be879f --- /dev/null +++ b/webpack.common.js @@ -0,0 +1,147 @@ +const webpack = require("webpack"); +const path = require("path"); +const MiniCssExtractPlugin = require("mini-css-extract-plugin"); +const VueLoaderPlugin = require('vue-loader/lib/plugin'); + +const assetsPath = path.resolve(__dirname, "resources/assets/javascripts"); + +const fs = require('fs'); +const version = fs.readFileSync(path.resolve(__dirname, 'VERSION'), 'utf-8') + .trim() + .split(' ') + .slice(1) + .join(' '); + +module.exports = { + entry: { + "studip-base": assetsPath + "/entry-base.js", + "studip-admission": assetsPath + "/entry-admission.js", + "studip-statusgroups": assetsPath + "/entry-statusgroups.js", + "studip-wysiwyg": assetsPath + "/entry-wysiwyg.js", + "studip-installer": assetsPath + "/entry-installer.js", + "print": path.resolve(__dirname, "resources/assets/stylesheets") + "/print.less", + "webservices": path.resolve(__dirname, "resources/assets/stylesheets") + "/webservices.scss" + }, + output: { + path: path.resolve(__dirname, "public/assets"), + chunkFilename: `javascripts/[id].chunk.js`, + filename: "javascripts/[name].js" + }, + module: { + rules: [ + { + test: /\.css$/, + use: [ + { + loader: MiniCssExtractPlugin.loader + }, + { + loader: "css-loader", + options: { + url: false, + importLoaders: 1 + } + }, + { + loader: "postcss-loader" + } + ] + }, + { + test: /\.scss$/, + use: [ + { + loader: MiniCssExtractPlugin.loader + }, + { + loader: "css-loader", + options: { + url: false, + importLoaders: 2 + } + }, + { + loader: "postcss-loader" + }, + { + loader: "sass-loader" + } + ] + }, + { + test: /\.less$/, + use: [ + { + loader: MiniCssExtractPlugin.loader + }, + { + loader: "css-loader", + options: { + url: false, + importLoaders: 2 + } + }, + { + loader: "postcss-loader" + }, + { + loader: "less-loader", + options: { + lessOptions: { + relativeUrls: false + } + } + } + ] + }, + { + test: /\.js$/, + exclude: /node_modules|ckeditor/, + use: { + loader: 'babel-loader' + } + }, + { + test: /\.vue$/, + loader: 'vue-loader' + } + ] + }, + plugins: [ + new VueLoaderPlugin(), + new MiniCssExtractPlugin({ + filename: "stylesheets/[name].css", + chunkFilename: `stylesheets/[name]-${version.replace(/\W/g, '-')}.css` + }), + ], + resolve: { + alias: { + 'vue$': 'vue/dist/vue.esm.js', + 'jquery-ui/data': 'jquery-ui/ui/data', + 'jquery-ui/disable-selection': 'jquery-ui/ui/disable-selection', + 'jquery-ui/focusable': 'jquery-ui/ui/focusable', + 'jquery-ui/form': 'jquery-ui/ui/form', + 'jquery-ui/ie': 'jquery-ui/ui/ie', + 'jquery-ui/keycode': 'jquery-ui/ui/keycode', + 'jquery-ui/labels': 'jquery-ui/ui/labels', + 'jquery-ui/jquery-1-7': 'jquery-ui/ui/jquery-1-7', + 'jquery-ui/plugin': 'jquery-ui/ui/plugin', + 'jquery-ui/safe-active-element': 'jquery-ui/ui/safe-active-element', + 'jquery-ui/safe-blur': 'jquery-ui/ui/safe-blur', + 'jquery-ui/scroll-parent': 'jquery-ui/ui/scroll-parent', + 'jquery-ui/tabbable': 'jquery-ui/ui/tabbable', + 'jquery-ui/unique-id': 'jquery-ui/ui/unique-id', + 'jquery-ui/version': 'jquery-ui/ui/version', + 'jquery-ui/widget': 'jquery-ui/ui/widget', + 'jquery-ui/widgets/mouse': 'jquery-ui/ui/widgets/mouse', + 'jquery-ui/widgets/draggable': 'jquery-ui/ui/widgets/draggable', + 'jquery-ui/widgets/droppable': 'jquery-ui/ui/widgets/droppable', + 'jquery-ui/widgets/resizable': 'jquery-ui/ui/widgets/resizable', + '@': path.resolve(__dirname, 'resources') + }, + fallback: { + 'stream': require.resolve("stream-browserify"), + 'buffer': require.resolve("buffer/") + } + } +}; |
