You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some feedback regarding ts-transform-paths vs. typescript-transform-paths.
If no paths specified in tsconfig.json at all, ts-transform-paths does nothing (typescript-transform-paths does nothing as well btw). E.g.:
// tsconfig.json
"baseUrl": "src"
"plugins": [{ "transform": "@zerollup/ts-transform-paths" }],
// main.ts
import { app } from "electron"; // a module in node_modules
import { setMenu } from "main/menu"; // a module in the current dir
// output:
const electron_1 = require("electron");
const menu_1 = require("main/menu"); // <-- NOT ./main/menu
Both plugins activate when I add a dummy paths entry to tsconfig.json. BUT your module doesn't differentiate between a module in node_modules and a local one, whilst typescript-transform-paths does:
// tsconfig.json
"baseUrl": "src"
"plugins": [{ "transform": "@zerollup/ts-transform-paths" }],
"paths": { "*": ["*"] },
// main.ts
import { app } from "electron"; // a module in node_modules
import { setMenu } from "main/menu"; // a module in the current dir
// output of ts-transform-paths (incorrect):
const electron_1 = require("./electron"); // <-- doesn't understand it's in node_modules
const menu_1 = require("./main/menu");
// output of typescript-transform-paths (correct):
const electron_1 = require("electron"); // <-- OK
const menu_1 = require("./main/menu"); // <-- OK
My IMHO about all that is following: it's a little strange to require "paths" to be present in tsconfig.json. I think in an ideal world, the transform plugin should do exactly the same as TS does when it interprets the entire configuration. If TS understands just baseUrl and shows no syntax errors in both tsc and in VSCode, if it allows to do import from "xyz/abc" where xyz is located in baseUrl, then the transform plugin should do no worse than that. (And I also think that in an ideal world, tsc should have a config option to alter paths natively; although I read their arguments, they still look very weak to me.)
The text was updated successfully, but these errors were encountered:
Thanks for this plugin!
Some feedback regarding ts-transform-paths vs. typescript-transform-paths.
paths
specified in tsconfig.json at all, ts-transform-paths does nothing (typescript-transform-paths does nothing as well btw). E.g.:My IMHO about all that is following: it's a little strange to require "paths" to be present in tsconfig.json. I think in an ideal world, the transform plugin should do exactly the same as TS does when it interprets the entire configuration. If TS understands just baseUrl and shows no syntax errors in both tsc and in VSCode, if it allows to do
import from "xyz/abc"
wherexyz
is located in baseUrl, then the transform plugin should do no worse than that. (And I also think that in an ideal world, tsc should have a config option to alter paths natively; although I read their arguments, they still look very weak to me.)The text was updated successfully, but these errors were encountered: