question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tsconfig.json support?

See original GitHub issue

Hi there!

Thanks for the helpful plugin! I’m trying to integrate esbuild into rollup using your plugin and it seems that it doesn’t support tsconfig.json completely? At least it doesn’t respect compilerOptions.baseUrl and compilerOptions.paths. These are path aliases which allow to write

import '@alias/module'

instead of

import `../../../../../../../../some-folder/module`

(well, I think you know, but just for clarity 😃 ) And as far as I know esbuild itself supports these options (https://github.com/evanw/esbuild/issues/60 and https://github.com/evanw/esbuild/issues/38#issuecomment-639784830).

Or maybe I missed something?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:16
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
ycnmhdcommented, Dec 13, 2020

found a workaround using @rollup/plugin-alias

import path from "path";
import resolve from "rollup-plugin-node-resolve";
import esbuild from "rollup-plugin-esbuild";
import alias from "@rollup/plugin-alias";

const projectRootDir = path.resolve(__dirname);

export default {
  /**/
  plugins: [
    alias({
      customResolver: resolve({ extensions: [".tsx", ".ts"] }),
      entries: Object.entries({
        "::helpers/*": ["./src/helpers/*"],
        "::hooks/*": ["./src/hooks/*"]
        /**/
      }).map(([alias, value]) => ({
        find: new RegExp(`${alias.replace("/*", "")}`),
        replacement: path.resolve(
          projectRootDir,
          `${value[0].replace("/*", "")}`
        )
      }))
    }),
    esbuild({
      /**/
    })
  ]
};
2reactions
egoistcommented, Dec 11, 2020

The solution is to use @rollup/plugin-alias as @ycnmhd said, there’s also alias-hq (by @davestewart) to reduce boilerplate code.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - What is a tsconfig.json - TypeScript
See our full list of supported Compiler Options. TSConfig Reference. To learn more about the hundreds of configuration options in the TSConfig Reference....
Read more >
tsconfig.json - TypeScript Deep Dive - Gitbook
Good IDEs come with built in support for on the fly ts to js compilation. However, if you want to run the TypeScript...
Read more >
tsconfig.json - TypeScript - JavaScript that scales.
The tsconfig.json file specifies the root files and the compiler options required to ... Example tsconfig.json files: ... The supported glob wildcards are:....
Read more >
tsconfig.json demystified - understanding the tsc compiler
To help you build up your tsconfig.json files for new projects, ... Modern browsers support all ES6 features, so leaving target at ES6...
Read more >
TypeScript configuration - Angular
It is a superset of JavaScript with design-time support for type safety and ... At the root tsconfig.json file specifies the base TypeScript...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found