Cannot find module package.json
See original GitHub issueDescribe 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
- Create a start
- Include
@angular-builders/custom-webpack:browser
- Create a
webpack.config.ts
- Add package.json as a module
- Run
npm run build
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.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
6 - Stack Overflow
There are a lot, but I can't seem to find a solution for this. I've already deleted node_modules folder and package-lock.json file from...
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
Read more >Error: Cannot find module '/package.json' · Issue #1353 - GitHub
Dashboard app unable to start, displaying error message. After starting the Cube.js development server $ npm run dev Navigate to "Dashboard ...
Read more >Error: Cannot find module in JavaScript [SOLVED]
We can solve Error: Cannot find module by installing the missing module. We can use npm tool to install the mising module.
Read more >Cannot find module '<project path>/src/package.json' after run ...
Hello, good day, I've an annoying problem, I wanted to jump to the package.json file but by mistake I click over "package.json file......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just fyi with
require
the error is gone and it works as expected.For 2. I think you are right. Might be better to hardcode it and later add that it is using the app’s tsconfig.