-
Notifications
You must be signed in to change notification settings - Fork 69
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
Chaining into rpt2 from a non-.ts file? #111
Comments
@coolreader18 did you try adding |
Could you make a small repo with reproduction (or post a link to your full repo if it is opensource) |
Adding it to tsconfig.json didn't help, it's giving the same error. The repo is coolreader18/betterfunction. |
I have analyzed this problem recently. Refer to tsne/rollup-plugin-tsc#4 (comment). |
@coolreader18 I looked at what happens again (using your repo at last aug 31st commit) and it seems like rollup never tries to pass *.ne files to rpt2 at all, imports got converted to requires and left that way. Either I reconstructed the problem incorrectly, or @chinesedfan could you make an example repo that reproduces this? |
@chinesedfan ok this should be fixed in master |
@ezolenko In fact, it is the extra filter, not |
@chinesedfan does current master work for you (if you set correct include in both tsconfig and plugin include option)? Not sure I want to always pass everything that is in tsconfig, it is tempting, but I'm not sure how to treat plugin's own include/exclude option then. |
@ezolenko Thanks. It works. I noticed that rpt2 is different with rollup-plugin-tsc. It uses filter created by plugin include/exclude, instead of language service filter. And |
Fixed in 0.18.0 |
What happens and why it is wrong
I'm compiling nearley to typescript and trying to pass it through to rpt2, but it's not working. The plugin just returns the compiled code, and I tried adding
["*.ne", "**/*.ne"]
to the rpt2 options, but just doing that wasn't working, giving an errorError: Could not find file: '/home/coolreader18/Projects/betterfunction/src/lib/grammar/index.ne'.
. After doing some debugging in typescript, I figured out that it was because it wasn't including the .ne file in the compilation, and it was erroring in theservice.getEmitOutput
call in index.ts L195. Is there maybe an alternate call to use to get the output from a file? Before trying to refactor it into chaining, I just calledtypescript().transform.call(this, code, id + ".ts")
from the nearley plugin, and that worked. Maybe error handling for that call, and on an error it just uses the source code provided as a parameter?Versions
rollup.config.js
https://gist.github.com/coolreader18/c15cb2e0e8483d6c69769a0b8ade20a3
Previously I was doing:
in the transform function, but I think chaining is a lot cleaner and less hacky.
tsconfig.json
plugin output with verbosity 3
Full error message:
The text was updated successfully, but these errors were encountered: