ncc icon indicating copy to clipboard operation
ncc copied to clipboard

import.meta.url stays original after compilation, how to get compiled file path

Open sbcgua opened this issue 3 years ago • 2 comments

Let's suppose a file located at /<packagerootdir>/lib/xyz/someaction.js. After compilation I place the resulting file in e.g. /app/dist/index.js. The someaction.js used import.meta.url to find it's location. And it was working well in the uncompiled code. But for the compiled import.meta.url returns /app/lib/xyz/someaction.js. So:

  1. This is incorrect because /app/lib/xyz/someaction.js does not exist
  2. This is incorrect because the index.js is actually in /app/dist ... and dist part is missing in the resulting path anyway
  3. Finally it is not clear how to get compiled index.js path properly.

sbcgua avatar Apr 08 '22 10:04 sbcgua

Sounds like #897 will fix this

styfle avatar Apr 08 '22 14:04 styfle

Looks promising indeed, thanks ! Will follow that PR.

sbcgua avatar Apr 09 '22 11:04 sbcgua