-
-
Notifications
You must be signed in to change notification settings - Fork 590
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
Typescript plugin 4.0.0 Error: Unexpected token (Note that you need plugins to import files that are not JavaScript) #287
Comments
Thanks for opening an issue. Citing the issue template:
Please add a reproduction and we'll be happy to triage further. |
I have the same error and made a small project to reproduce the error (see this project) |
I switched back to @rollup/plugin-typescript version 3.1.1. In this version I don't have the problems. I use tsc to make the declarations. |
Thanks for the reproduction @JohanSchobben |
Quick fix for now is to manually set your rootDir compiler option to "src". |
@sssylvan I' getting this error:
|
@talentlessguy I resolved this problem by removing |
I have a case when I need to generate typings, so it won't work probably |
I run {
...
"scripts": {
"build": "tsc --outDir dist/lib --declarationDir dist/types --declaration true && rollup -c",
"prepare": "npm run build"
}
} |
This comment has been minimized.
This comment has been minimized.
I fixed this by deleting [EDIT] Even better, seems like if I remove just |
I thought I had the same issue - maybe it is related. I have a monorepo like this:
// somemod.ts
export const theAnswer: number = 42; // A.ts
import {theAnswer} from "../../shared/src/somemod";
console.log(theAnswer); When I run the build in |
Have the same problem, repo at https://github.com/Jack-Works/async-call/tree/rollup ( |
This comment has been minimized.
This comment has been minimized.
Downgrade to 3.1 doesn't work for me
Doesn't work for me either |
Oh strange, |
Oh sorry, my fault. I put my ts plugin in the output config, therefore, it's not working |
We had a problem where --preserveSymlinks solved it... hard to understand why though. |
Adding the |
I had to downgrade to version 3.1 as well, nothing else worked for me. |
- update Node version - update dependencies - fixed rollup/plugin-typescript issue (rollup/plugins#287) - ensure styled-components uses the same React type version as we do
I use ver I removed declaration from tsconfig and added manually generated it after building with rollup.
|
Adding To tsconfig.json fixed this issue for me. |
@ivankoleda when I run |
I tried changing:
To:
But got:
Perhaps you know if there are different types of hosts @NotWoods or how to get the appropriate host? I'm not sure I have a lot more time to spend on this at the moment, but hopefully this info helps move the investigation along a bit. |
That seems like the right direction, thanks for the info! I'll investigate the host a bit more. |
Ah, sadly that's a private TypeScript API so we can't use it in the plugin. |
I've filed a bug over in the TypeScript repo for the I also wrote a test in #682 |
Woohoo! It looks like this bug is getting fixed already! microsoft/TypeScript#41811 |
The fix has been merged in TypeScript and should be released with TypeScript 4.2.0. We can leave this open until then to track and make sure that we can enable the failing test when 4.2.0 is released |
@benmccann it looks like we can close this one out. thoughts? |
@shellscape I am still running into this issue, and I tried 4.2.0 |
I just confirmed that the test passes with typescript 4.2.0-beta (#789). I'm not quite sure if you need to upgrade the typescript version used in your project and/or the plugin |
Works on my machine with typescript 4.2.0-beta und plugin version 8.1.1. |
We've got a pending partial fix cued up in #794 as well. We'll do a preflight check to see if the |
PSA: "me too" replies that don't contain diagnostic info or info to assist in triage will be removed from the issue |
Seems like rollup is not capable of handling case insensitivity of the working directory on windows, specifically the drive letter:
Same build, nothing changed except one thing: We now have a capital C: in our working dir:
Please get this fixed. We could reproduce this behaviour on 15 machines now. |
@NIX-Pepe we'll welcome your contribution and look forward to your pull request to fix this. |
@shellscape This is a bug and as such it deserves your attention, It's THE most upvoted issue in the history of this repo. |
@AradAral you all really should read this https://liberamanifesto.com/ The maintainers here give their time freely to the community. Your demands for action are unwarranted, entitled, and just plain rude. If you'd like to see an issue resolved at a faster pace than maintainers are able to accomplish, your effort and time are required to make that happen. Thus is the nature of open source. We're locking this issue to maintainers moving forward, and anyone viewing this issue unable to comment can thank @AradAral for that. If anyone would like to help the project and their fellow users out by submitting a fix for this issue, we'll gladly welcome it! |
How Do We Reproduce?
Expected Behavior
Actual Behavior
I hope I'm doing something wrong because it is so bad to cant use ts plugin.
Ts plugin version 3.0.0 works perfect by the way.
The text was updated successfully, but these errors were encountered: