Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Disable terser plugin optionally with OPENPROJECT_ANGULAR_OPTIMIZATION=false

Oliver Günther773a41d1ac32
diff --git a/.github/workflows/pullpreview.yml b/.github/workflows/pullpreview.yml
index c55088cc8cf..538f9e0ddc8 100644
--- a/.github/workflows/pullpreview.yml
+++ b/.github/workflows/pullpreview.yml
@@ -33,6 +33,7 @@ jobs:
echo "OPENPROJECT_FEATURE__SHOW__CHANGES__ACTIVE=true" >> .env.pullpreview
echo "OPENPROJECT_LOOKBOOK__ENABLED=true" >> .env.pullpreview
echo "OPENPROJECT_HSTS=false" >> .env.pullpreview
+ echo "OPENPROJECT_ANGULAR_UGLIFY=false" >> .env.pullpreview
- name: Boot as BIM edition
if: contains(github.ref, 'bim/') || contains(github.head_ref, 'bim/')
run: |
diff --git a/frontend/extra-webpack.config.js b/frontend/extra-webpack.config.js
index 62dc085402e..0744375e538 100644
--- a/frontend/extra-webpack.config.js
+++ b/frontend/extra-webpack.config.js
@@ -5,6 +5,7 @@ module.exports = {
minimizer: [
new TerserPlugin({
terserOptions: {
+ mangle: process.env.OPENPROJECT_ANGULAR_OPTIMIZATION !== 'false',
keep_classnames: true,
keep_fnames: true,
}
diff --git a/frontend/package.json b/frontend/package.json
index b5a9124d350..aed1c4d56f2 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -181,6 +181,7 @@
"scripts": {
"analyze": "ng build --configuration production --stats-json && webpack-bundle-analyzer -h 0.0.0.0 -p 9999 ../public/assets/frontend/stats.json",
"build:ci": "node ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map=false",
+ "build:fast": "node ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map=false --optimization=false",
"build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production --named-chunks --source-map",
"build:watch": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --watch --named-chunks",
"tokens:generate": "theo src/app/spot/styles/tokens/tokens.yml --transform web --format sass,json --dest src/app/spot/styles/tokens/dist",
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index b7da60c72f3..a261d24c7e2 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -62,7 +62,15 @@ namespace :assets do
puts "Building angular frontend"
Dir.chdir Rails.root.join('frontend') do
- cmd = ENV['CI'] ? 'npm run build:ci' : 'npm run build'
+ cmd =
+ if ENV['CI']
+ 'npm run build:ci'
+ elsif ENV['OPENPROJECT_ANGULAR_OPTIMIZATION'] == 'false'
+ 'npm run build:fast'
+ else
+ 'npm run build'
+ end
+
sh(cmd) do |ok, res|
raise "Failed to compile angular frontend: #{res.exitstatus}" if !ok
end