yahoo / ycb-config

Configuration manager for Yahoo configuration bundles.
BSD 3-Clause "New" or "Revised" License
12 stars 16 forks source link

Fix import issue for module #35

Closed itssumitrai closed 2 years ago

itssumitrai commented 2 years ago

In my modern vite App running on Node 16.13, I am seeing this error:

Error: Cannot find module '/Users/raisumit/Documents/Programs/nimbus/node_modules/ycb-config/lib/mjs/modern.js' imported from '/Users/raisumit/Documents/Programs/nimbus/node_modules/ycb-config/lib/mjs/index.js'
    at viteResolve (/Users/raisumit/Documents/Programs/nimbus/node_modules/vite/dist/node/chunks/dep-f5552faa.js:60126:25)
    at Function.<anonymous> (/Users/raisumit/Documents/Programs/nimbus/node_modules/vite/dist/node/chunks/dep-f5552faa.js:60140:28)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/raisumit/Documents/Programs/nimbus/node_modules/ycb-config/lib/mjs/index.js:9:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)

Through tinkering I found that just using relative path here fixes the resolution issue from before. This should work regardless of any node version.

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.