3.7.2.3. Build System and Project Structure

The following tools are used in Polymer client build chain:

By default Gradle handles installation and invocation of these tools. It’s possible to use them directly, see Using Native Polymer Tools.

Polymer 2.x and its native elements are written using ES6, thus it requires an additional build step (ES6 → ES5 compilation) in order to support old browsers.

The default preset used in Polymer client is es6-unbundled. It means that if you are targeting old browsers and production deployment you should change it to es5-bundled.

In order to change build preset open polymer.json and change builds property accordingly e.g.:

  "builds": [
    {
      "preset": "es5-bundled",
      "basePath": "/app-front/",
      "addServiceWorker": false
    }
  ]

You can specify several presets or customize build process in polymer.json. More info about presets and options is available on Polymer website.

In order the results of specific preset build being deployed to Tomcat you need to change deploy task in build.gradle:

    task deploy(type: Copy, dependsOn: [assemble, deployUnbundled]) {
        from file('build/es5-unbundled')
        into "$cuba.tomcat.dir/webapps/$frontAppDir"
    }

Notice es6-bundledes5-unbundled change in polymer.json and build.gradle.