From 6fdbad45d15a49da46659e745d13c7cb9ebe038f Mon Sep 17 00:00:00 2001 From: hydrant Date: Tue, 12 Mar 2019 16:01:46 +0100 Subject: [PATCH] Added server build mode for webpack --- .gitlab-ci.yml | 14 +++++---- ReallifeGamemode.Client/package.json | 3 +- .../webpack.config.build.js | 30 +++++++++++++++++++ ...onfig.js => webpack.config.development.js} | 2 +- 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 ReallifeGamemode.Client/webpack.config.build.js rename ReallifeGamemode.Client/{webpack.config.js => webpack.config.development.js} (97%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6becb4f6..a4c3b01e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,18 +1,22 @@ stages: - build +cache: + key: ${CI_COMMIT_REF_SLUG} + paths: + - ReallifeGamemode.Client/node_modules/ + before_script: - - "dotnet restore" - "git lfs install" - "git lfs pull" -variables: - GIT_STRATEGY: clone - build: stage: build only: - develop@log-gtav/reallife-gamemode script: - "../gm_database_password.sh" - - "dotnet build -c ServerBuild" \ No newline at end of file + - "dotnet build -c ServerBuild" + - "cd ReallifeGamemode.Client/" + - "yarn install" + - "yarn run build:server" \ No newline at end of file diff --git a/ReallifeGamemode.Client/package.json b/ReallifeGamemode.Client/package.json index fa7ffb7f..500228c5 100644 --- a/ReallifeGamemode.Client/package.json +++ b/ReallifeGamemode.Client/package.json @@ -17,6 +17,7 @@ "webpack-cli": "^3.2.3" }, "scripts": { - "run": "webpack --watch" + "watch": "webpack --watch --config webpack.config.development.js", + "build:server": "webpack --config webpack.config.build.js" } } diff --git a/ReallifeGamemode.Client/webpack.config.build.js b/ReallifeGamemode.Client/webpack.config.build.js new file mode 100644 index 00000000..f4061f27 --- /dev/null +++ b/ReallifeGamemode.Client/webpack.config.build.js @@ -0,0 +1,30 @@ +const path = require('path'); + +module.exports = { + mode: 'production', + entry: './index.ts', + output: { + path: path.resolve(__dirname), + filename: 'index.js' + }, + module: { + rules: [ + { + test: /\.js$/, + use: { loader: 'babel-loader' } + }, + { + test: /\.ts$/, + use: { + loader: 'ts-loader', + options: { + allowTsInNodeModules: true + } + } + } + ] + }, + resolve: { + extensions: ['.ts', '.js', '.json'] + } +}; \ No newline at end of file diff --git a/ReallifeGamemode.Client/webpack.config.js b/ReallifeGamemode.Client/webpack.config.development.js similarity index 97% rename from ReallifeGamemode.Client/webpack.config.js rename to ReallifeGamemode.Client/webpack.config.development.js index c00a18e5..84fe1797 100644 --- a/ReallifeGamemode.Client/webpack.config.js +++ b/ReallifeGamemode.Client/webpack.config.development.js @@ -2,7 +2,7 @@ const CopyPlugin = require('copy-webpack-plugin'); module.exports = { - mode: 'production', + mode: 'development', entry: './index.ts', output: { path: path.resolve(__dirname, '..', '..', 'client_packages'),