ng build not copying folder to dist

55 Views Asked by At

I am using protobufjs-cli to generate a .js file from .proto files and then from the .js file I generate a .d.ts file, which is imported and used in various files in my project (using Angular 15).

When I run ng build my-project the folder containing the generated .js/.d.ts files is not copied to /dist. As a result, ng build fails with:

Generating FESM2020
Could not resolve "../proto/ProtoDefs" from "dist/my-project/esm2020/rules/rules.mjs"

rules.ts has:

import root from "../proto/ProtoDefs";

The folder structure looks like:

  node_modules
  projects
    my-project
      src
        proto
          Protodefs.d.ts
          Protodefs.js
        rules
          rules.ts

How can I get the proto folder to be copied to /dist before the build starts so that the build does not fail? Why isn't it copied like all of the other folders under src?

I am still pretty new to angular/typescript so am not sure if there is some setting in some config somewhere that I am missing. Everything works fine when I run ng serve (no resolve errors).

Let me know if you need more info.

0

There are 0 best solutions below