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

Type only imports are not set as dependencies #7

Closed
ezolenko opened this issue Mar 14, 2017 · 9 comments · Fixed by #406
Closed

Type only imports are not set as dependencies #7

ezolenko opened this issue Mar 14, 2017 · 9 comments · Fixed by #406
Labels
kind: bug Something isn't working properly scope: cache Related to the cache scope: watch mode Related to Rollup's watch mode topic: type-only / emit-less imports Related to importing type-only files that will not be emitted

Comments

@ezolenko
Copy link
Owner

After interface modification the plugin (v0.3.0) serves depending files from the cache, missing potentially breaking changes.

To reproduce make a clean build, break a type-only ts file and rerun a build.

@ezolenko ezolenko self-assigned this Mar 14, 2017
@ezolenko ezolenko added this to the 0.4.0 milestone Mar 14, 2017
@ezolenko ezolenko modified the milestones: 0.4.1, 0.4.0 Mar 28, 2017
@ezolenko
Copy link
Owner Author

Might depend on resolution of one of those:
rollup/rollup#1203
rollup/rollup#1248

@ezolenko ezolenko removed this from the 0.4.1 milestone Apr 20, 2017
@ezolenko ezolenko removed their assignment Jun 15, 2017
@yankeeinlondon
Copy link

Can't wait to see this included, looks like your blockers are starting to have PR's against them.

@ezolenko
Copy link
Owner Author

Also affects watch mode, need to add all files specified by tsconfig to rollup watch list

@posva
Copy link

posva commented Jul 14, 2019

is this error the same:

(!) Import of non-existent export
src/rtdb/utils.ts
1: import { database } from 'firebase';

database is type only and there isn't a real export in the js file:

(!) Error when using sourcemap for reporting an error: Can't resolve original location of error.
src/rtdb/utils.ts: (1:9)
[!] Error: 'database' is not exported by ../../../node_modules/firebase/dist/index.esm.js

@ezolenko
Copy link
Owner Author

ezolenko commented Jul 15, 2019

@posva No, your error looks different. You can't really import anything a module is not exporting. If you want side effects, you can do plain import 'firebase'. What happens if you simply remove that import?

@posva
Copy link

posva commented Jul 15, 2019

If I remove it it doesn't compile because it's missing that database namespace. It's weird because the error only happens for packages/@posva/vuefire-core but not for packages/vuefire (in a learn monorepo). I ended up creating an alias (rollup-plugin-alias) for the firebase package that resolves to a stub that exports empty objects. It suppress the errors with rollup while still getting correct typings output:

@domoritz
Copy link
Contributor

I think this bug causes a problem in my builds as well. I am missing declaration files for files that export only types. Is this captured by this issue? Are there any known workarounds?

@agilgur5
Copy link
Collaborator

agilgur5 commented Jun 5, 2022

Wrote up a root cause analysis for all type-only import issues in #298 (comment).

Also wrote up a PR that is a partial fix for type-only imports in #345

@agilgur5
Copy link
Collaborator

This has been fixed in #406 and released in 0.34.0 🎉

Repository owner locked as resolved and limited conversation to collaborators Jul 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind: bug Something isn't working properly scope: cache Related to the cache scope: watch mode Related to Rollup's watch mode topic: type-only / emit-less imports Related to importing type-only files that will not be emitted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants