Skip to content
This repository has been archived by the owner on Feb 14, 2023. It is now read-only.

.js modules not found #10

Open
c-ciobanu opened this issue Oct 27, 2020 · 1 comment
Open

.js modules not found #10

c-ciobanu opened this issue Oct 27, 2020 · 1 comment

Comments

@c-ciobanu
Copy link

Trying to import a .js file as this

  import:
    - module: config/dynamic.js
      inputs:
        var: test

will throw the following error.

Error: Cannot import config/dynamic.js
Cause: Cannot find module 'config/dynamic.js'

The problem seems to be with the import path, the issue seems to be in this check that will not fail

if (tryOrUndefined(() => statSync(pathToImport))) {

but the subsequent require will.
const importExports = require(importPath)

Removing the check fixes the problem.
A solution would be to bypass the check if the file has a .js ext or completely removing the check but don't know if that impacts something else, didn't dig too much into the code.

@ignacioalles
Copy link

Aside from the modifications you've made to make it work, I've found that using an absolute .js path also make it work. It is not very usefull to me but perhaps it might help you.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants