mirror of
https://github.com/vercel/commerce.git
synced 2025-06-30 18:31:21 +00:00
Add local next.config to Vendure provider, update docs
This commit is contained in:
parent
cec55b792e
commit
c2703abc98
@ -7,7 +7,7 @@ const fs = require('fs')
|
|||||||
const merge = require('deepmerge')
|
const merge = require('deepmerge')
|
||||||
const prettier = require('prettier')
|
const prettier = require('prettier')
|
||||||
|
|
||||||
const PROVIDERS = ['bigcommerce', 'shopify', 'swell']
|
const PROVIDERS = ['bigcommerce', 'shopify', 'swell', 'vendure']
|
||||||
|
|
||||||
function getProviderName() {
|
function getProviderName() {
|
||||||
return (
|
return (
|
||||||
|
1
framework/vendure/.env.template
Normal file
1
framework/vendure/.env.template
Normal file
@ -0,0 +1 @@
|
|||||||
|
NEXT_PUBLIC_VENDURE_SHOP_API_URL=http://localhost:3001/shop-api
|
@ -4,13 +4,7 @@ UI hooks and data fetching methods built from the ground up for e-commerce appli
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### 1. Choose a Vendure server
|
#### 1. Running a local Vendure server
|
||||||
|
|
||||||
For the fastest start, you can point to the live Vendure demo server which runs at https://demo.vendure.io. This lets you work with the Vendure data hooks without needing to set up a local server.
|
|
||||||
|
|
||||||
If you want to have more control over the server, then getting up an running with a local server is only slightly more work:
|
|
||||||
|
|
||||||
#### 1a. Running a local Vendure server
|
|
||||||
|
|
||||||
1. Install Vendure locally with one command:
|
1. Install Vendure locally with one command:
|
||||||
```shell
|
```shell
|
||||||
@ -36,35 +30,12 @@ If you want to have more control over the server, then getting up an running wit
|
|||||||
### 2. Set up the Commerce storefront
|
### 2. Set up the Commerce storefront
|
||||||
|
|
||||||
1. Clone this repo and install its dependencies with `yarn install` or `npm install`
|
1. Clone this repo and install its dependencies with `yarn install` or `npm install`
|
||||||
2. Change the paths in [tsconfig.json](../../tsconfig.json) to point to the Vendure hooks:
|
2. Set the Vendure provider and API URL in your `.env.local` file:
|
||||||
```diff
|
|
||||||
- "@framework/*": ["framework/bigcommerce/*"],
|
|
||||||
- "@framework": ["framework/bigcommerce"]
|
|
||||||
+ "@framework/*": ["framework/vendure/*"],
|
|
||||||
+ "@framework": ["framework/vendure"]
|
|
||||||
```
|
```
|
||||||
3. Set the Vendure Shop API URL in your `.env.local` file:
|
COMMERCE_PROVIDER=vendure
|
||||||
```sh
|
|
||||||
NEXT_PUBLIC_VENDURE_SHOP_API_URL=http://localhost:3001/shop-api
|
NEXT_PUBLIC_VENDURE_SHOP_API_URL=http://localhost:3001/shop-api
|
||||||
```
|
```
|
||||||
or if using the live demo server:
|
3. With the Vendure server running, start this project using `yarn dev` or `npm run dev`.
|
||||||
```sh
|
|
||||||
NEXT_PUBLIC_VENDURE_SHOP_API_URL=https://demo.vendure.io/shop-api
|
|
||||||
```
|
|
||||||
4. Add the server domain to the `images` property next.config.js file as per the [image optimization docs](https://nextjs.org/docs/basic-features/image-optimization#domains)
|
|
||||||
```js
|
|
||||||
module.exports = {
|
|
||||||
// ...
|
|
||||||
images: {
|
|
||||||
domains: [
|
|
||||||
'localhost',
|
|
||||||
// or
|
|
||||||
'demo.vendure.io',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}
|
|
||||||
```
|
|
||||||
5. With the Vendure server running, start this project using `yarn dev` or `npm run dev`.
|
|
||||||
|
|
||||||
## Known Limitations
|
## Known Limitations
|
||||||
|
|
||||||
|
8
framework/vendure/next.config.js
Normal file
8
framework/vendure/next.config.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
const commerce = require('./commerce.config.json')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
commerce,
|
||||||
|
images: {
|
||||||
|
domains: ['localhost'],
|
||||||
|
},
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user