Skip to content

Cannot find module package.json #816

@muuvmuuv

Description

@muuvmuuv

Describe the Bug

I would like to use a custom webpack typescript config with the define plugin but cannot import package.json. Which tsconfig is taken by angular-builders for the webpack config compilation? I tried adding that file to every webpack config without success.

webpack.config.ts:7:22 - error TS2732: Cannot find module './package.json'. Consider using '--resolveJsonModule' to import module with '.json' extension

7 import * as pkg from './package.json'

Minimal Reproduction

  1. Create a start
  2. Include @angular-builders/custom-webpack:browser
  3. Create a webpack.config.ts
  4. Add package.json as a module
  5. Run npm run build

https://github.com/muuvmuuv/angular-builders-issues-816

Expected Behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment


Libs
- @angular/core version: 10.0.10
- @angular-devkit/build-angular version: 0.1000.6
- @angular-builders/custom-webpack version: 10

For Tooling issues:
- Node version: 12.18.0
- Platform: latest macOS

Others:

Additional Context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions