GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — About transpiled require path · Issue #1611 · TypeScriptToLua/TypeScriptToLua

About transpiled require path #1611

New issue
Copy link
New issue
Copy link
Open
Open
About transpiled require path#1611
Copy link

Description

@ChouUn
ChouUn
opened on Jan 15, 2025
Issue body actions

Structure:

- project/
    - src/
    - tsconfig.json
- wc3-mono/
    - pkgs/
        - wc3-base/
            - src/
                - Game.ts
            - package.json
        - wc3-types/
    - package.json

The package manager is Yarn 2 with PnP, and I have executed yarn link.
so package.json be like:

{
  "devDependencies": {
    "wc3-base": "workspace:^",
  },
  "resolutions": {
    "wc3-base": "portal:../wc3-mono/pkgs/wc3-base",
  }
}

To be able to use import { Game } from 'wc3-base/Game', I should write tsconfig.json as:

{
  "compilerOptions": {
    "baseUrl": "./src",
    "paths": {
      "wc3-base/*": ["../../wc3-mono/pkgs/wc3-base/src/*"]
    },
  },
}

This has made me a little uncomfortable.
Perhaps there is a more elegant solution.

And the import statement will be transpiled as require("wc3-mono.pkgs.wc3-base.src.Game") finally.
It makes me very upset. I expected that I would get a require("wc3-base.Game")

I spent a lot of time reading the source code of TSTL so that I could write a plugin to change the situation.
But I didn't succeed, so I'm looking for some help on where to start.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.