Angular build cannot resolve '../package' and 'child_process' #152
Comments
|
Hi Tomáš, Part of the issue here is that this is meant to be an isomorphic library (able to be used either in the browser or in Node.js), and so the build step has to substitute node-only libraries for browser equivalents. Basically, you need to add an "ignore" list to whatever build tool you're using, Browserify or Webpack etc. For example, if you're using Webpack, you should add the following items to the |
|
I see. Thank you Dmitri. It's weird that angular-cli does not allow to change webpack's configuration by design (angular/angular-cli#1656). To change the webpack config it is possible to avoid serving through angular-cli: Run |
angular-cli is reporting "Can't resolve" errors when building Angular application which uses solid-client.
One of the errors is pointing to this repository and second one points to a XMLHttpRequest - dependency used by rdflib.
Error message
Information
solid-client: 0.24.3
# ng version @angular/cli: 1.2.1 node: 8.1.2 os: linux x64 @angular/animations: 4.3.0 @angular/common: 4.3.0 @angular/compiler: 4.3.0 @angular/core: 4.3.0 @angular/forms: 4.3.0 @angular/http: 4.3.0 @angular/platform-browser: 4.3.0 @angular/platform-browser-dynamic: 4.3.0 @angular/router: 4.3.0 @angular/cli: 1.2.1 @angular/compiler-cli: 4.3.0 @angular/language-service: 4.3.0How to reproduce (assuming angular-cli is properly installed):
create new angular app and enter its directory
ng new angular-solid-client cd angular-solid-clientinstall solid-client
add lib import and usage into file:
src/app/app.component.tsrun
ng buildOr you can clone my seed repo in tag v0.1.0:
Workaround
'../package' resolve error can be fixed simply by adding ".json" extension to a filename required in
node_modules/solid-client/lib/meta.js:7.Change:
to
'child_process' error is caused by removed package replaced by empty nameholder. This module seems to be required only for synchronous calls but since it is empty it should be safe to just comment 'spawn' require in
xmlhttprequest/lib/XMLHttpRequest.js:15.Change:
so it looks like this
The text was updated successfully, but these errors were encountered: