-
Notifications
You must be signed in to change notification settings - Fork 39
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
Error when building angular app with solid-client: Module '"../constants"' has no exported member 'acp' #608
Comments
Thanks for reporting this issue so thoroughly. We'll have a look and get back to you. All the best, |
Thank you. I think the problem is the libraries are not ready to be used with angular. I have tried excluding the files manually and encountered various different errors. First, in the build log:
but more importantly, this in the browser:
|
Thanks for reporting this @WhyINeedToFillUsername. I was able to reproduce your issue and possibly identified the fix. Could you verify whether the fix works for you by installing |
(Re-opening since we haven't had confirmation that the issue is fixed yet - sorry!) |
Thank you for quick reaction! I am sorry, but the fix did not work for me. I still get:
I've pushed the updated version to the package.json of the https://github.com/WhyINeedToFillUsername/solid-error project. |
@WhyINeedToFillUsername solid-client-authn apparently makes use of the (I do get the following error, but they don't sound related to solid-client or solid-client-authn-browser:
) |
As @Vinnl says, with the latest WebPack, some Node builtins must be manually provided to solid-client-authn, namely |
@Vinnl sorry, I've fixed it, but forgot to push the fix.. it is in the repo now. I have installed I've also tried But no success, I still get the same error:
I've pushed an 'additional_dependencies' branch so you can test this. I suggest 'ng build', which gives more verbose information. @NSeydoux thank you, I will look into the webpack configuration, however I don't know how to modify the angular's webpack to accommodate this. |
This is now flagged as a known issue for Angular and we are looking at adding support for browser/node-specific crypto libraries in the near future. In the meantime, the workaround is to change your project's webpack configuration to manually add those dependencies as @NSeydoux and @Vinnl explained. Cheers, |
Jeezus this is a rabbit hole! I've tried using a custom webpack configuration as you suggest. In order to do so, in this Angular 10 I am using, you have to use "@angular-builders/custom-webpack" and "@angular-devkit/build-angular". Those are using webpack 4, which does not have the resolve.fallback option you are using to fix this. Both previous and next webpack versions do have this option... I am trying to use another version of angular and the builders to see if they updated webpack as well. |
FYI, it didn't help. Angular 11 has option to use webpack 5 (only with Yarn, https://blog.angular.io/version-11-of-angular-now-available-74721b7952f7), but in order to use custom webpack configuration, one has to use "@angular-builders/custom-webpack" and "@angular-devkit/build-angular" packages (https://medium.com/angular-in-depth/customizing-angular-cli-build-an-alternative-to-ng-eject-v2-c655768b48cc), which rely on webpack 4 and the build does not work. |
So I have finally found a hackish way to make it work. In the repo in branch custom-webpack (https://github.com/WhyINeedToFillUsername/solid-error/tree/custom-webpack), you can see how. I am manually supplying the modules + need to replace the import statements in some places. It is a very bad solution, but I am able to login and read Inrupt profile with it. There might be some other ways how to use the custom webpack configuration or to supply fallback for those missing libraries (namely another package for supplying custom webpack config: https://github.com/manfredsteyer/ngx-build-plus). Maybe the real question here is - why is solid-client-authn using crypto, stream (and util?) node libraries, and not their browser versions (crypto-browserify etc.)? |
Good to hear you managed to find some way of getting this to work. For some additional context: Webpack 4 and below did natively include those polyfills, but Angular explicitly disabled those. However, if you are able to customise the Webpack configuration for Webpack 4, you might have been able to re-enable the polyfills yourself. That said, if you are now able to use the latest Angular version, that is probably preferable. As for your final question: that is basically the result of a changing ecosystem. When the project was started, most bundlers included those polyfills by default, and existing crypto libraries that worked in both the browser and Node (that we build on) relied on those being supplied by the developer. Since then, updated versions of libraries have been made available that do indeed fall back to the browser-native utilities first, and we hope to be able to adopt those soon. |
Since the original issue has been fixed, I'll close this issue. As for the question of polyfills in solid-client-authn-browser, I think this ticket is the most relevant one: inrupt/solid-client-authn-js#1099 If you have any further issues, feel free to log a new issue or to re-open this one. Cheers! |
Which original issue do you mean? I haven't tried it, but if the library is still using the node.js dependencies, the issue will remain. |
@WhyINeedToFillUsername This:
The dependencies on Node.js is, as I understand it, in solid-client-authn, whereas this is the solid-client repository. Hence, I think the issue about SCA using Node dependencies is this one: inrupt/solid-client-authn-js#1099 But let me know if I have misunderstood something :) |
Search terms you've used
inrupt module acp
Bug description
npm error when building application with "@inrupt/solid-client": "^1.0.0", using angular's
ng build
To Reproduce
ng new solid-error
)npm install @inrupt/solid-client @inrupt/solid-client-authn-browser @inrupt/vocab-common-rdf
)import {getSolidDataset, getStringNoLocale, getThing} from '@inrupt/solid-client';
in a componentng serve
)Expected result
application gets built without error and starts
Actual result
the following error occurs:
ERROR in node_modules/@inrupt/solid-client/dist/acp/control.d.ts:21:10 - error TS2305: Module '"../constants"' has no exported member 'acp'.
Environment
Additional information
I've created a sample angular project with the error: https://github.com/WhyINeedToFillUsername/solid-error
npm install
andng serve
The text was updated successfully, but these errors were encountered: