Skip to content

Commit

Permalink
New export of <RedwoodApolloProvider>
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jan 14, 2021
1 parent 8ede02d commit c4ecabe
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
7 changes: 7 additions & 0 deletions packages/core/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@ module.exports = (webpackEnv) => {
'node_modules',
'styled-components'
),
// This is needed because we don't yet have support for this:
// https://webpack.js.org/guides/package-exports/
'@redwoodjs/web/apollo': path.resolve(
redwoodPaths.base,
'node_modules',
'@redwoodjs/web/dist/components/apollo'
),
react: path.resolve(redwoodPaths.base, 'node_modules', 'react'),
},
},
Expand Down
6 changes: 3 additions & 3 deletions packages/testing/src/MockProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from 'react'

import { AuthProvider } from '@redwoodjs/auth'
import type { AuthContextInterface } from '@redwoodjs/auth'
import { RedwoodProvider } from '@redwoodjs/web'
import { RedwoodApolloProvider } from '@redwoodjs/web/apollo'

import { mockedUserMeta } from './mockRequests'

Expand Down Expand Up @@ -53,10 +53,10 @@ export const mockAuthClient = {
export const MockProviders: React.FunctionComponent = ({ children }) => {
return (
<AuthProvider client={mockAuthClient} type="custom">
<RedwoodProvider useAuth={fakeUseAuth}>
<RedwoodApolloProvider useAuth={fakeUseAuth}>
<UserRouterWithRoutes />
{children}
</RedwoodProvider>
</RedwoodApolloProvider>
</AuthProvider>
)
}
3 changes: 2 additions & 1 deletion packages/testing/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
"outDir": "dist",
"paths": {
"src/*": ["./src/*"]
"src/*": ["./src/*"],
"@redwoodjs/web/apollo": ["../web/dist/components/apollo"]
}
},
"include": [
Expand Down
6 changes: 5 additions & 1 deletion packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
"files": [
"dist"
],
"main": "dist/index.js",
"main": "./dist/index.js",
"exports": {
".": "./dist/index.js",
"./apollo": "./dist/components/apollo.js"
},
"types": "dist/index.d.ts",
"license": "MIT",
"dependencies": {
Expand Down
6 changes: 6 additions & 0 deletions packages/web/src/components/apollo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// We link to this file using "paths" in testing/tsconfig.js because TS
// doesn't support "exports" in package.json yet. When that is resolved
// this file should stay, but the config in tsconfig.json should be
// removed.
// See https://github.com/microsoft/TypeScript/issues/33079
export { RedwoodApolloProvider } from './RedwoodApolloProvider'
1 change: 0 additions & 1 deletion packages/web/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import './global.web-auto-imports'
import './config'

export { default as FatalErrorBoundary } from './components/FatalErrorBoundary'
export { RedwoodApolloProvider as RedwoodProvider } from './components/RedwoodApolloProvider'
export {
FetchConfigProvider,
useFetchConfig,
Expand Down

0 comments on commit c4ecabe

Please sign in to comment.