Parcel: Running behind a reverse proxy: Cannot resolve dependency

Created on 9 Apr 2018  路  4Comments  路  Source: parcel-bundler/parcel

Choose one: is this a 馃悰 bug report or 馃檵 feature request?

馃檵 feature request

馃帥 Configuration (.babelrc, package.json, cli command)

<html>
  <body>
    <img src="/images/foobar.jpg"/>
  </body>
</html>
$ <run api on port 9090>
$ <run local image service on port 8080 >
$ npx parcel src/index.html --no-cache # run on port 1234

I'm running a reverse proxy locally on port 80 which is dispatching requests depending their URLs:

  • /api/* => pointing to a xyz API (on port 9090)
  • /images/* => pointing to an image service, store images in memory or in database (on port 8080)
  • /dist/* => pointing to parceljs (on port 1234)
  • /* => pointing to parceljs (on port 1234)

Then, I'm browsing localhost:80 to access all three services, including parceljs and my image service.

馃 Expected Behavior



I expect to have parcel running

馃槸 Current Behavior


Parcel is throwing an error and fail to start:
Cannot resolve dependency './../../../../../images/foobar.jpg' at '/images/foobar.jpg'

馃拋 Possible Solution

Either:

  • be able to run parceljs without checking every assets URLs,
  • add a flag to parcel to downgrade severity from errors to warning
  • anything ideas ? :-)

I had a look on the changes included in the next release e.g. https://github.com/parcel-bundler/parcel/pull/850 but I think it's a different issue.

馃敠 Context


I'm trying to use parceljs in a micro-services architecture but I can't.

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel |1.6.2
| Node |9.9.0
| npm/Yarn |5.7.1
| Operating System |

Feature

Most helpful comment

EDIT: So you want to be able to ignore certain files from being resolved by parcel at build time, now I get it, sorry for the mixup.

This has been discussed in a few issues now, but there isn't really a solution for it yet, as it would end up adding extra configuration.

All 4 comments

Update to 1.7 to make sure the resolver hasn't fixed it, as absolute paths got fixed in 1.7

Hi, sorry it's not the main problem. The image doesn't exist in the filesystem because it's provided by a image service which is available only at runtime (thru a reverse proxy running locally).

EDIT: So you want to be able to ignore certain files from being resolved by parcel at build time, now I get it, sorry for the mixup.

This has been discussed in a few issues now, but there isn't really a solution for it yet, as it would end up adding extra configuration.

Yeah, I guess adding extra configuration is reasonable, either in the markup (e.g. parcel-ignore=1) or in a config file. As long as it makes this scenario possible... cuz at the moment I am blocked and I'm not able to run parcel with the current micro-services architecture :cry: :cry:

Was this page helpful?
0 / 5 - 0 ratings