Skip to content

Commit 2623b32

Browse files
committed
feat: improve ESM support
1 parent 3caf750 commit 2623b32

File tree

18 files changed

+66
-24
lines changed

18 files changed

+66
-24
lines changed

packages/vue-apollo-components/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@
55
"main": "dist/vue-apollo-components.umd.js",
66
"module": "dist/vue-apollo-components.esm.js",
77
"unpkg": "dist/vue-apollo-components.min.js",
8+
"exports": {
9+
".": {
10+
"import": "./dist/vue-apollo-components.esm.js",
11+
"require": "./dist/vue-apollo-components.umd.js"
12+
},
13+
"./*": "./*"
14+
},
815
"scripts": {
916
"build": "pnpm run build:browser && pnpm run build:es && pnpm run build:umd",
1017
"build:browser": "rollup --config build/rollup.config.browser.js",

packages/vue-apollo-composable/package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
"main": "dist/index.js",
2626
"types": "dist/index.d.ts",
2727
"module": "dist/index.esm.js",
28+
"exports": {
29+
".": {
30+
"types": "./dist/index.d.ts",
31+
"import": "./dist/index.esm.js",
32+
"require": "./dist/index.js"
33+
},
34+
"./*": "./*"
35+
},
2836
"files": [
2937
"dist"
3038
],

packages/vue-apollo-composable/src/useApolloClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getCurrentInstance, inject } from 'vue-demi'
2-
import { ApolloClient } from '@apollo/client/core'
2+
import { ApolloClient } from '@apollo/client/core/index.js'
33

44
export const DefaultApolloClient = Symbol('default-apollo-client')
55
export const ApolloClients = Symbol('apollo-clients')

packages/vue-apollo-composable/src/useMutation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DocumentNode } from 'graphql'
2-
import { MutationOptions, OperationVariables, FetchResult, TypedDocumentNode, ApolloError } from '@apollo/client/core'
2+
import { MutationOptions, OperationVariables, FetchResult, TypedDocumentNode, ApolloError } from '@apollo/client/core/index.js'
33
import { ref, onBeforeUnmount, isRef, Ref, getCurrentInstance } from 'vue-demi'
44
import { useApolloClient } from './useApolloClient'
55
import { ReactiveFunction } from './util/ReactiveFunction'

packages/vue-apollo-composable/src/useQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import type {
2121
ObservableSubscription,
2222
TypedDocumentNode,
2323
ApolloError,
24-
} from '@apollo/client/core'
24+
} from '@apollo/client/core/index.js'
2525
import { throttle, debounce } from 'throttle-debounce'
2626
import { useApolloClient } from './useApolloClient'
2727
import { ReactiveFunction } from './util/ReactiveFunction'

packages/vue-apollo-composable/src/useSubscription.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import type {
1717
ObservableSubscription,
1818
TypedDocumentNode,
1919
ApolloError,
20-
} from '@apollo/client/core'
20+
} from '@apollo/client/core/index.js'
2121
import { throttle, debounce } from 'throttle-debounce'
2222
import { ReactiveFunction } from './util/ReactiveFunction'
2323
import { paramToRef } from './util/paramToRef'

packages/vue-apollo-composable/src/util/toApolloError.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ApolloError, isApolloError } from '@apollo/client/core'
2-
import { GraphQLErrors } from '@apollo/client/errors'
1+
import { ApolloError, isApolloError } from '@apollo/client/core/index.js'
2+
import { GraphQLErrors } from '@apollo/client/errors/index.js'
33

44
export function toApolloError (error: unknown): ApolloError {
55
if (!(error instanceof Error)) {

packages/vue-apollo-composable/tests/fixtures/graphql-example-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import gql from 'graphql-tag'
2-
import { TypedDocumentNode } from '@apollo/client/core'
2+
import { TypedDocumentNode } from '@apollo/client/core/index.js'
33

44
export type ID = string
55

packages/vue-apollo-option/package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@
55
"main": "dist/vue-apollo-option.umd.js",
66
"module": "dist/vue-apollo-option.esm.js",
77
"unpkg": "dist/vue-apollo-option.min.js",
8-
"typings": "types/index.d.ts",
8+
"types": "types/index.d.ts",
9+
"exports": {
10+
".": {
11+
"types": "./types/index.d.ts",
12+
"import": "./dist/vue-apollo-option.esm.js",
13+
"require": "./dist/vue-apollo-option.umd.js"
14+
},
15+
"./*": "./*"
16+
},
917
"scripts": {
1018
"build": "pnpm run build:browser && pnpm run build:es && pnpm run build:umd",
1119
"build:browser": "rollup --config build/rollup.config.browser.js",

packages/vue-apollo-option/types/apollo-provider.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint no-unused-vars: 0 */
22

33
import { ComponentOptions, AsyncComponentOptions, App } from 'vue'
4-
import { ApolloClient } from '@apollo/client/core'
4+
import { ApolloClient } from '@apollo/client/core/index.js'
55
import {
66
VueApolloComponentOptions,
77
WatchLoading,

0 commit comments

Comments
 (0)