-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
require("https") #22
Comments
Are you using the latest version? Could you send me a sample of how you're using it? I'm using it just fine in form scripts, node applications and web resources using Vue and Angular 6. Are you using webpack for the build? |
"https" is just a standard node module so not sure why it wouldn't be able to find it. You could try installing @types/node although it's not really necessary. It could just be something with angular-cli build process as well. Upgrading to Angular 6 might be a good idea since I have a project using it that builds fine. |
Sorry for the delayed answer (was on holiday). It seems to be an userspecific problem. Interestingly the same code works with another user (same settings, and everything though). But i am gonna update my Infos ASAP. |
I'm also experiencing this same problem. I following the same basic steps. I have a fairly vanilla Angular 6 site.
Thanks |
I found the answer here. So just add
to the file mentioned in that link. |
Update a file inside of node_modules? Won't that get clobbered with every fresh npm install. |
Yes but that appears to be the fix. It's an issue with angular. The better solution would be to separate the node version of xrm-webapi library from the browser version so you only import one or the other. I'll try and come up with a way to do that. |
Our solution goes through CI builds...so the build server is always going to have a fresh npm install, so that configuration change would never survive. |
I won't have a chance to test until later tonight but you could try the answer here. It adds a package that lets you customize the angular-cli webpack config which is what we're doing. |
Has this been resolved? |
Just pushed up a new version that resolves this. To use for angular, you need to import from |
please assist, none of these two options seem to work... |
You'll need to import WebApiConfig and Guid from "xrm-webapi" still. It's just the actual api methods that you need to import from "xrm-webapi/dist/webapi-browser". I updated the README to be more clear in that regard |
@derekfinlinson |
I tried the new update but still got the same error. I ended up using the original fix approach. Adding am extra webpack config and then modifying angular.json like this.
Then my extra webpack.config looks like this.
|
I thought I had tested before updating and realized I was incorrect on where to import stuff from. You needed to import everything from the individual files instead of from the xrm-webapi. After some thought, it seems the most frequently used instance of this library is in the browser so those will be exported from xrm-webapi. I moved the node exports (and https) into a separate file. The latest version should fix this. |
🎉 This issue has been resolved in version 6.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi there,
i am currently using (trying to use) your npm package. Sadly there is a build error when i am using your npm package in my webressource (written in angular 4). The problem there seems to be the 'require("https")' in request.js.
It statens:
ERROR in ./node_modules/xrm-webapi/dist/request.js
Module not found: Error: Can't resolve 'https' in 'MY PATH....\node_modules\xrm-webapi\dist'
It does not seem to get the https reference which is definitly needed, when you use it as a regular npm import. I did not manage to make it work properly, so as i always use your code out of a 'window' i have simply removed the 'reuqire("https")' to make it buildable and workable. This means for me i only can use it from a webressource (which is totally fine, as i only am going to use it in this form), but i can not update this file atm, as it would update this file again. Maybe you can integrate my thought or process in future bug fixes or versions.
If my request is unclear, not enough specified or anything else, please let me know.
Best regards
Daniel
The text was updated successfully, but these errors were encountered: