Currently we are using 2 build systems, Webpack and Gulp. Currently Webpack is used for all "new" code written in the webapps directory and Gulp is used for all the "old" code in the scripts / css directories in WebContent.
You should not have to run any builds if you just try to start your server and don't work in JS and CSS. Maven should be taken care of the below builds for you.
You have to have nodejs and npm installed. The versions that have to be installed are:
NodeJS 9.7.1:
download for windows | download for mac
After you have installed this run the following command in your command line, this will install npm version 5.7.1
When you have installed NodeJS and NPM it's very important to fix permission issue's that NodeJS will run into on mac. Follow to instruction for OPTION 2 in this guide: Fix Permission Issue's
If you see the self signed certificate in certificate chain exception on your terminal run the command as shown below
After above options you will have to run an install on globalWeb, in your terminal make sure you are in your globalWeb directory inside your workspace
To run a build once run the following commands in your globalWeb directory in your terminal:
If you are actively developing the frontend code you want to watch the files there are 2 ways to do this either run a devserver (faster and hot reloading) or run a simple watch command
If you want to run with the devserver approach you will have to a config line to your local config properties:
after you done this and you start your workspace tomcat server you won't see any styles / javascript running. Now it's time to start your devserver for static assets. Follow below commands to do so.
If you want to mimic production builds you can do so by running:
(NOTE: make sure you have the /od/config/frontend/devserver property set to false otherwise it won't work in your local
If you wish to run manual builds you have to make sure you have webpack 3.11.0 and gulp 4.0 installed globally on your machine
Next step is to actually run the builds, in your terminal make sure you are in the globalWeb directory in your workspace
if you see an error that looks like this:
mkdir: cannot create directory '[folder_name]': Permission denied
This means your NPM permission are not correct, go back to STEP 1 and follow the fix permission issue's link.
if you see an error that looks like this:
Error: Cannot find module '../../lib/optimize/CommonsChunkPlugin'
This means someone is linking to a package in either JS, CSS or SCSS that could not be found, fix the path or check if the files even exist.
If you are getting any self signed cert or TLS handshake errors follow the below commands to fix this for mac:
For windows add this environment variable: NODE_TLS_REJECT_UNAUTHORIZED=0 (How to set env variable
Then follow below steps: