The instructions in this article are applicable only if you want to tinker with the LuciadRIA sample code yourself.

To start the LuciadRIA samples as they come in the release, without modification, start the sample server with the startSampleServer script, and go to Samples to select and launch samples.

Quick overview

  1. Make sure your system setup covers all prerequisites, as described in the installation instructions.

  2. Run npm install in the root of the LuciadRIA distribution.
    As a result, all sample dependencies are installed. You have to install these only once for the release. See Bootstrapping dependencies.

  3. Start the sample server with the startSampleServer script in the root of the LuciadRIA distribution. See Running the sample server for more information.

  4. Run npm run dev in the directory of the sample you want to edit and run.
    A browser window opens automatically. It runs your sample and watches the files in that directory. If you edit and save a file in that directory, the running sample changes automatically, and the browser window refreshes. See Running a webpack dev-server for a sample.

Bootstrapping dependencies

Before you can deploy the samples in the samples/ directory, you must install all dependencies of the LuciadRIA distribution and its individual samples. To install the dependencies, you must execute npm install in the root of the LuciadRIA distribution. This command first installs all development dependencies declared in the root package.json, and then executes lerna bootstrap, through a post-install script. The lerna bootstrap links the local dependencies of all samples to the correct packages and installs all external npm dependencies in the correct node_modules folder. Lerna also takes care of dependency hoisting: dependencies that are common to different samples are only installed once in a higher-level node_modules directory.

After bootstrapping the dependencies of all samples, you can set up your web application.

Running the sample server

Several samples do not fetch their data locally, but request it from a server, or use other data services. In the LuciadRIA distribution, a sample server is provided to host those services. You can run the sample server by executing the startSampleServer script. The server is hosted on http://localhost:8072 by default.

Running a webpack dev-server for a sample

When you are developing an application, it is useful to run a development server, or dev-server. A development server serves the application and watches the source files for changes. It will serve those changes without a server restart. To start a webpack dev-server for a sample application in the LuciadRIA distribution:

  1. Make sure you have bootstrapped the sample dependencies, as explained in Bootstrapping dependencies.

  2. Go to the samples/ directory and execute npm run dev.
    By default, a dev-server starts hosting the First Sample on http://localhost:3001/. It also watches the bundled files so that any changes in the source code or styling are picked up and served as long as the dev-server is running.

You can also add arguments to npm run dev by adding -- and one or more argument tags at the end:


Specify the port on which the webpack dev-server will run.


Set this argument to run the sample using a WebGL map.


Set this argument to run the sample using a 3D WebGL map.


Specifies the URL (and port) on which the sample server is running.


Specifies the URL (and port) on which the LuciadFusion server is running.

The webpack configuration file of all samples extends from samples/common/webpack.config.js. See the webpack configuration web page for more information.

Building and running the sample

When you are deploying a real application, just running the provided webpack dev-server will not suffice. You will need to take care of other steps, such as minification/uglification or chunk splitting as well, before you can serve the application.

Building and running samples may require a significant amount of memory. To execute the build, you need to configure the amount of memory that Node.js can use. You can do so by setting the NODE_OPTIONS environment variable to --max-old-space-size=4096.

To build and run the application, take these steps:

  1. Run the npm run build command in the sample directory.
    The sample is packaged to packed-samples/ria/<sample>

    The original sample in that directory will be overwritten, so it might be a good idea to back that up first.

  2. Start the sample server by running the startSampleServer script.

  3. Open your browser, and point it to http://localhost:8072/samples/<sample>. A new web page displays your application.

This uses the same webpack configuration file as discussed in Running a webpack dev-server for a sample.