Skip to content

Commit

Permalink
chore: 0.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Baroshem committed Feb 24, 2023
1 parent 1747f16 commit e055ec6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ And that's it! You can now fetch data from Medusa in Nuxt ✨
</script>
```

If you are encountering problems with `CORS` from Medusa, make sure that `process.env.STORE_CORS` in `medusa-config.js` file is pointing to your local Nuxt project. By default, Medusa has CORS set for `http://localhost:8000` while Nuxt is running by default on `http://localhost:3000`

## Development

```bash
Expand Down
4 changes: 4 additions & 0 deletions docs/content/1.getting-started/1.setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ That's it! You can now fetch data from Medusa in your Nuxt app ✨
</script>
```

::alert{type="warning"}
If you are encountering problems with `CORS` from Medusa, make sure that `process.env.STORE_CORS` in `medusa-config.js` file is pointing to your local Nuxt project. By default, Medusa has CORS set for `http://localhost:8000` while Nuxt is running by default on `http://localhost:3000`
::

## Options

You can customize the module's behavior by using the `medusa` property in `nuxt.config`:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuxt-medusa",
"version": "0.2.1",
"version": "0.2.6",
"description": "Medusa module for Nuxt",
"license": "MIT",
"type": "module",
Expand Down
7 changes: 6 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineNuxtModule, addPlugin, createResolver, addImportsDir } from '@nuxt/kit'
import { defineNuxtModule, addPlugin, createResolver, addImportsDir, extendViteConfig } from '@nuxt/kit'
import { fileURLToPath } from 'url'
import { defu } from 'defu'
import { Config } from '@medusajs/medusa-js'
Expand Down Expand Up @@ -31,6 +31,11 @@ export default defineNuxtModule<ModuleOptions>({

const runtimeDir = fileURLToPath(new URL('./runtime', import.meta.url))
nuxt.options.build.transpile.push(runtimeDir)
extendViteConfig((config) => {
config.optimizeDeps = config.optimizeDeps || {}
config.optimizeDeps.include = config.optimizeDeps.include || []
config.optimizeDeps.include.push('@medusajs/medusa-js', 'axios')
})
addImportsDir(resolver.resolve(runtimeDir, 'composables'))

if (options.server) {
Expand Down

1 comment on commit e055ec6

@vercel
Copy link

@vercel vercel bot commented on e055ec6 Feb 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nuxt-medusa – ./

nuxt-medusa-baroshem.vercel.app
nuxt-medusa-git-main-baroshem.vercel.app
nuxt-medusa.vercel.app

Please sign in to comment.