davidgeary opened a new issue #265: URL: https://github.com/apache/couchdb-nano/issues/265
## Expected Behavior I expect the project to build without errors. ## Current Behavior I'm writing an Angular project to which I've added nano (as per <https://github.com/apache/couchdb-nano#typescript>). But as soon as I include a call such as: ``` typescript let n = Nano('http://localhost:5984'); ``` I get errors when building the project about missing modules, eg: > Error: ./node_modules/nano/lib/nano.js > Module not found: Error: Can't resolve 'http' in 'C:\code\my-app\node_modules\nano\lib' (The actual error then lists all of the places it has checked for the existence of the missing module, which I'm omitting for brevity.) The same error message is repeated for the `https` and `stream` modules. ## Steps to Reproduce ### Stackblitz I've created a [sample of this on Stackblitz](https://stackblitz.com/edit/angular-with-nano?file=src%2Fapp%2Fapp.component.ts). Stackblitz doesn't show the full underlying console error message unfortunately, but does show the message: > Can't find packages: > url http https events punycode ### Locally If you have the Angular CLI installed, this can be seen in a minimal sample: Create a new Angular app and then install nano: ``` sh ng new my-app --minimal=true --routing=false --skipGit=true --interactive=false cd my-app npm install nano ``` Edit `tsconfig.json` to include `"allowSyntheticDefaultImports": true` under `compilerOptions`. Edit `app.component.ts` to: * import the nano library at the top of the file ``` typescript import * as Nano from 'nano'; ``` * add a function to call nano (we're only going to build the project, so it doesn't matter if the URL doesn't point to a valid CouchDB server): ``` typescript ngOnInit() { const connection = Nano('http://localhost:5984/'); } ``` Then build the project with `ng build` ## Your Environment * Version used: 9.0.3 * Angular version: 11.2 * Typescript version: 4.1.5 * Browser Name and version: N/A * Operating System and version (desktop or mobile): Windows 10 * Link to your project: <https://stackblitz.com/edit/angular-with-nano?file=src%2Fapp%2Fapp.component.ts> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
