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

This util doesn't work in this project #125

Closed
zyf0330 opened this issue Jul 30, 2021 · 4 comments
Closed

This util doesn't work in this project #125

zyf0330 opened this issue Jul 30, 2021 · 4 comments

Comments

@zyf0330
Copy link

zyf0330 commented Jul 30, 2021

Hello, I find that this transformer doesn't work in one scene. I create a demo repo https://github.com/zyf0330/transform-paths-demo/tree/main, just follows README.

@nonara
Copy link
Collaborator

nonara commented Jul 31, 2021

Unfortunately, I'm unable to reproduce that using your project.

Here are the steps I took:

git clone https://github.com/zyf0330/transform-paths-demo/tree/main
cd transform-paths-demo
npm install
cd packages/b
npm run build

This is the compiled result (from index2.js):

exports.src1 = void 0;
// import * as src1 from "../src1/index1"
const src1 = __importStar(require("../../../built/packages/a/src/index1"));
exports.src1 = src1;
console.log('in src2', src1.E);
const _2_1 = require("./2");
console.log('two', _2_1.s);

I recommend erasing node_modules and reinstalling. Then, check that typescript is patched via ts-patch check.

If it still does not work and you have new steps which can reproduce the problem, please let me know, and I'll have a look.

@zyf0330
Copy link
Author

zyf0330 commented Aug 2, 2021

const src1 = __importStar(require("../../../built/packages/a/src/index1")); shows that src1 is requiring from wrong path. Just run it with node, you can see.
The correct path is require('../../a/src/index1.js')

@nonara
Copy link
Collaborator

nonara commented Aug 3, 2021

Ah I see. Sorry about that, you're right. I thought you meant it didn't transform at all. I will try to take a closer look this weekend.

@nonara nonara closed this as completed in 4a16396 Aug 16, 2021
@nonara
Copy link
Collaborator

nonara commented Aug 16, 2021

Ok, sorry for the delay on this one. Thanks again for bringing it to my attention!

Turns out the plugin wasn't playing well with project references. The problem happened when the referenced file was outside of the current project. Weird stuff to do with how TypeScript handles resolution paths. Should be sorted out now in v3.3.1!

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

No branches or pull requests

2 participants