question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Library Build - Data path "" should NOT have additional properties("fileReplacements")

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

Node: 9.11.2 NPM: 5.6.0

Angular CLI: 6.2.3
Node: 9.11.2
OS: darwin x64
Angular: 6.1.8
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.8.3
@angular-devkit/build-angular      0.8.3
@angular-devkit/build-ng-packagr   0.8.3
@angular-devkit/build-optimizer    0.8.3
@angular-devkit/build-webpack      0.8.3
@angular-devkit/core               0.8.3
@angular-devkit/schematics         0.8.3
@angular/cli                       6.2.3
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.2.3
@schematics/angular                0.8.3
@schematics/update                 0.8.3
ng-packagr                         4.2.0
rxjs                               6.2.2
typescript                         2.9.2
webpack                            4.19.1

Repro steps

I generated a new project which I want to create a library from. I then updated the angular.json file to include a production configuration object (to do minification and some other steps).

$ ng new my-project
$ cd my-project
$ ng generate library my-library
$ # Update angular.json to include a "configurations" object with some certain options
$ ng build my-library --prod

The changes added to the angular.json file:

          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true
            }

The log given by the failure

$ ng build my-library --prod
Schema validation failed with the following errors:
  Data path "" should NOT have additional properties(fileReplacements).

Desired functionality

I would expect this to not have an issue with this configuration, or provide a message that explains what is wrong.

Mention any other details that might be useful

Do Angular libraries not support having a configuration object? If that’s the case, it may be useful to include an error that clarifies this. I’m not able to tell if it’s supported or not through this. If it does support a configuration object, it seems like I’m missing something else.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Sep 25, 2018

Hi, thanks for reporting this but the library builders doesn’t support any of those properties.

Valid properties are listed here: https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_ng_packagr/src/build/schema.json

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data path "" must NOT have additional properties(extractCss ...
I am facing an issue while upgrading my project from angular 8.2.1 to angular 13 version. After a successful upgrade while preparing a...
Read more >
angular/angular - Gitter
When I copy this to the library build object I get this error: ... following errors: Data path "" should NOT have additional...
Read more >
Schema validation failed with the following errors: Data path ...
[Solved]-Error: Schema validation failed with the following errors: Data path "" should NOT have additional properties(project)-angular.js. Search.
Read more >
Building and serving Angular apps
Each named configuration can have defaults for any of the options that apply to ... You can add further variables, either as additional...
Read more >
Developers - fileReplacements fails for .json files in Angular 11 -
A fileReplacement definition of a .json file fails in Angular 11 when building with @angular-builders/custom-webpack@11.0.0-beta.1 and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found