-
-
Notifications
You must be signed in to change notification settings - Fork 431
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
Unable to load default and exported from vue templates #1351
Comments
@jrbasso, I don't use Vue but I took a look at your ts-loader-9 repo. I saw the same error message you report. TypeScript is complaining that
I appreciate this may not be a generic solution to this issue. The thread below discusses this error when importing interfaces from Vue components: I don't know why it worked in ts-loader-8 but it seems to me that the error TypeScript is reporting is correct. Perhaps the Vue community has found a solution. |
Fair enough. That was my understanding, but since it was working on ts-loader 8.x I thought it had some magic internally. To avoid adding the interface on the shim I created a definition file just for the class that exports the interface. Do you want to leave this ticket open to handle a fix on 8.x or should it be closed? |
I'd quite like for this to be fixed in ts-loader - I think it's an issue. But as I'm not a Vue user I'm not well placed to help. My guess is that the answer lies in looking at the That's where we went from ts-loader 8 to 9 and where I assume the break happened. (Maybe worth checking that v9.0.0 was the first version where this didn't work) The |
I've just run into this while trying to import interfaces exported from Vue SFCs. I'm not using the shim for vue so the resulting error is a TS2307:
Downgrading from 9.2.6 to 8.3.0 also fixes the problem for me (maintaining running webpack 5). I can verify that 9.0.0 was the version that broke things. I'm going to take a look at the PR above and try and isolate what's causing it. |
@johnnyreilly I don't suppose you still have a copy of the feat/webpack-5 branch? There's nothing that stands out for me as a breaker, I was going to go commit by commit through your changes but can't sync the un-merged commits as the branch no longer exists. |
I have a feeling I haven't I'm afraid. Did a |
Actually comparing the transpiled code for |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Here's a workaround for the ts-loader 9.x.
|
Expected Behaviour
I expect to import default and exported interfaces from ts file/portion. It was working on ts-loader 8.x with webpack 4.x and it's failing on ts-loader 9.x with webpack 5.x.
It even works on ts-loader 8.x using webpack 5.x (not recommended since I believe it's not designed for).
Actual Behaviour
Typescript return the error TS2614 when trying to do an import like
import HelloWorld, { HelloProp } from './components/HelloWorld.vue';
See the full output:
Steps to Reproduce the Problem
I created a sample to reproduce the working and not working versions:
To reproduce, simply checkout the branch and run
npm ci && ./node_modules/.bin/webpack
Location of a Minimal Repository that Demonstrates the Issue.
See steps to reproduce.
The text was updated successfully, but these errors were encountered: