Skip to content

Commit 2844182

Browse files
committed
fix(command/dev): move proxy path to respect router.base
1 parent ce7e59a commit 2844182

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
| Statements | Branches | Functions | Lines |
88
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
9-
| ![Statements](https://img.shields.io/badge/Coverage-91.23%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-72.22%25-red.svg) | ![Functions](https://img.shields.io/badge/Coverage-86.67%25-yellow.svg) | ![Lines](https://img.shields.io/badge/Coverage-92.04%25-brightgreen.svg) |
9+
| ![Statements](https://img.shields.io/badge/Coverage-91.45%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-71.93%25-red.svg) | ![Functions](https://img.shields.io/badge/Coverage-86.67%25-yellow.svg) | ![Lines](https://img.shields.io/badge/Coverage-92.24%25-brightgreen.svg) |
1010

1111
This package allows to develop a nuxt SPA as frontend for a laravel backend.
1212
The implementation is based on [laravel-nuxt-js](https://github.com/skyrpex/laravel-nuxt-js) by [skyrpex](https://github.com/skyrpex).

dist/subcommands/dev.js

+4-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/subcommands/dev.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ const config: NuxtLaravelCommandConfig = {
101101
)
102102
}
103103

104+
const renderRoot = (options.router && options.router.base) || ''
105+
const proxyPath = path.join(renderRoot, '**/*')
106+
const renderPath = path.join(renderRoot, `${argv['render-path']}`)
107+
104108
const overrides: typeof options = {
105109
// use @nuxtjs/proxy module
106110
axios: {
@@ -109,7 +113,7 @@ const config: NuxtLaravelCommandConfig = {
109113
// proxy all calls except the render path to laravel
110114
proxy: [
111115
[
112-
['**/*', `!${argv['render-path']}`],
116+
[proxyPath, `!${renderPath}`],
113117
{
114118
target: `http://${options.server!.host}:${+options.server!
115119
.port! + 1}`,

0 commit comments

Comments
 (0)