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

fix(examples): configuration of vite #1449

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/six-snakes-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@shopware-pwa/composables-next": patch
---

Add configuration step to README.md
3 changes: 3 additions & 0 deletions examples/b2b-quote-management/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import UnoCSS from "unocss/vite";

export default defineConfig({
plugins: [vue(), UnoCSS()],
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
3 changes: 3 additions & 0 deletions examples/blank-playground/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
3 changes: 3 additions & 0 deletions examples/commercial-quick-order/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
3 changes: 3 additions & 0 deletions examples/express-checkout/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
3 changes: 3 additions & 0 deletions examples/login-form/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
3 changes: 3 additions & 0 deletions examples/responsive-images/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
resolve: {
alias: {
"@": fileURLToPath(new URL("./src", import.meta.url)),
Expand Down
16 changes: 15 additions & 1 deletion packages/composables/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,29 @@ app.provide("apiClient", apiClient);
Now, we can create a Vue 3 plugin to install a Shopware context in an app:

```js
// app variable in type of App
import { createShopwareContext } from "@shopware-pwa/composables-next";

// app variable in type of App
const shopwareContext = createShopwareContext(app, {
devStorefrontUrl: "https://your-sales-channel-configured-domain.com",
});
// register a plugin in a Vue instance
app.use(shopwareContext);
```

Exclude `@shopware-pwa/composables-next` package from [pre-building](https://vite.dev/guide/dep-pre-bundling.html#customizing-the-behavior) process:

```ts
// vite.config.js or .ts
...
optimizeDeps: {
exclude: ["@shopware-pwa/composables-next"],
},
...
```

---

> The example does not provide the session handling and that means you need to do few additional steps if you need to keep your session after the page reload (see the chapter below with 🍪)

## Basic usage
Expand Down
4 changes: 3 additions & 1 deletion packages/composables/build.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { resolve } from "pathe";
export default defineBuildConfig({
entries: ["src/index"],
declaration: true,
rollup: {
inlineDependencies: true,
},
externals: [
"axios",
"vue",
Expand All @@ -16,5 +19,4 @@ export default defineBuildConfig({
"#imports": resolve("./src/index.ts"),
"#shopware": resolve("./types/api-types.ts"),
},
failOnWarn: false,
});
Loading