Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add jiti support #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

folliehiyuki
Copy link

This PR adds https://github.com/unjs/jiti as a supported loader.

@folliehiyuki
Copy link
Author

Sorry for the noisy ping, @pi0! As the maintainer of jiti, can you help me integrate it into gulpjs? I can't figure out why gulp doesn't do anything after loading jiti-register module.

Also, unlike other loaders listed in the index.js file, I can't find another way to supply custom options to jiti, except by setting environment variables. All those process.env calls seem pretty hacky (on top of them not working yet).

A simple setup for testing:

// package.json
///////////////////////////////
{
  "dependencies": {
    "gulp": "^5.0.0",
    "gulp-cli" "^3.0.0",
    "jiti": "^2.4.2"
  },
  "overrides": {
    "gulp-cli": {
      "interpret": "git+https://github.com/folliehiyuki/interpret#jiti-loader"
    }
  }
}

// gulpfile.ts
////////////////////////////////
function defaultTask(cb: any) {
  // place code for your default task here
  cb();
}

export default defaultTask;

Executing npm exec gulp should return nothing and succeed. Right now, it loads jiti module but still fails to recognize Typescript syntax.

@pi0
Copy link

pi0 commented Mar 17, 2025

Hi @folliehiyuki can you please clarify what specific options are currently not possible to be set via env variables? (and using loader approach, how to you see alternatives? feel free to create discussion upstream also 👍🏼 )

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

Successfully merging this pull request may close these issues.

2 participants