You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`root`|`string`| Path to laravel directory (is resolved relative to `process.cwd()`) |`process.cwd()`|
75
-
|`publicDir`|`string`| The folder where laravel serves assets from (is resolved relative to `root`) |`'public'`|
76
-
|`publicPath`|`string`| Folder location to which generated assets are output (is resolved relative to and must reside in `publicDir`) |`process.env.NUXT_OUTPUT_PATH \|\| nuxtConfig.router.base`|
77
-
|`outputPath`|`string`| File location to which the index route will be rendered, (is resolved relative to `root`) |`path.join(publicDir, publicPath, '_spa.html')`|
78
-
|`server`|`boolean` or `object`| Settings for the Laravel testserver |*(see below)*|
79
-
|`dotEnvExport`|`boolean`| Whether the `NUXT_OUTPUT_PATH` varibale should be written to the `.env` file in the laravel root directory |`false`|
|`root`|`string`| Path to laravel directory (is resolved relative to `process.cwd()`) |`process.cwd()`|
75
+
|`publicDir`|`string`| The folder where laravel serves assets from (is resolved relative to `root`) |`'public'`|
76
+
|`outputPath`|`string`| File location to which an additional index route will be rendered, useful if you want to store it in a folder outside of Laravels public dir (is resolved relative to `root`) |`null`|
77
+
|`server`|`boolean` or `object`| Settings for the Laravel testserver |*(see below)*|
78
+
|`dotEnvExport`|`boolean`| Whether the `NUXT_OUTPUT_PATH` varibale should be written to the `.env` file in the laravel root directory |`false`|
80
79
81
80
The module loads the `.env` file from yout laravel root, so you can set the `NUXT_OUTPUT_PATH` environment variable from there.
82
81
@@ -90,10 +89,10 @@ Setting this to `true` is equivalient to omitting it and will simply use the def
90
89
|`host`|`string`| Hostname for the testserver |`nuxtConfig.server.host`|
91
90
|`port`|`number`| Port for the testserver |`nuxtConfig.server.port + 1`|
92
91
93
-
#### The `publicPath` setting
92
+
#### Path resolution inside `publicDir`
94
93
95
-
If `publicPath` is set manually and does not reside inside configured`publicDir`the module will be deactivated.
96
-
If `publicPath` is set manually and is valid `nuxtConfig.router.base` will be overwritten with the resolved URL.
94
+
If `nuxtConfig.router.base` is not set the SPA will be generated in the`publicDir`root with an index file name of `spa.html`.
95
+
If `nuxtConfig.router.base` is set the SPA will be generated in a corresponding location inside `publicDir`with the default index file name `index.html`.
97
96
98
97
## Laravel integration
99
98
@@ -112,14 +111,16 @@ Laravel integration is accomplished through two environment variables.
112
111
113
112
### Example scaffolding in existent Laravel application
2. Migrate all dependencies and scipts (most importantly `dev` and `build`) from `resources/nuxt/package.json` into `package.json` in Laravel root and delete it
122
-
3. Move all configuration files from `resources/nuxt` to Laravel root (or merge where appropiate, e.g. `.eslintrc.js`)
123
+
3. Move all configuration files from `resources/nuxt` to Laravel root (or merge where appropiate, e.g. `.editorconfig`)
123
124
4. Install the module and it's peer dependencies
124
125
125
126
```bash
@@ -130,9 +131,23 @@ Laravel integration is accomplished through two environment variables.
130
131
131
132
```js
132
133
module.exports= {
134
+
srcDir:'resources/nuxt',
133
135
mode:'spa',
134
-
// ...
135
-
modules: ['nuxt-laravel']
136
+
// ... other config
137
+
modules: [
138
+
'nuxt-laravel',
139
+
// ... other modules
140
+
]
141
+
}
142
+
```
143
+
144
+
6. (Optional) If you use jest, or other tools that reference the Nuxt root independently, you have to update thier respective configuration to make them work correctly.
145
+
Example `jest.config.js`:
146
+
147
+
```js
148
+
module.exports= {
149
+
rootDir:'resources/nuxt',
150
+
// ... other configurtion
136
151
}
137
152
```
138
153
@@ -189,7 +204,7 @@ Route::get(
189
204
190
205
Make sure nuxt path resolution of nuxt router corresponds to the defined routes.
191
206
192
-
> **IMPORTANT:** This example assumes the module option `publicPath` to have been set to `'app'`.
207
+
> **IMPORTANT:** This example assumes option `nuxtConfig.router.base` to have been set to `'/app/'`.
|`root`|`string`| Path to laravel directory (is resolved relative to `process.cwd()`) |`process.cwd()`|
75
-
|`publicDir`|`string`| The folder where laravel serves assets from (is resolved relative to `root`) |`'public'`|
76
-
|`publicPath`|`string`| Folder location to which generated assets are output (is resolved relative to and must reside in `publicDir`) |`process.env.NUXT_OUTPUT_PATH \|\| nuxtConfig.router.base`|
77
-
|`outputPath`|`string`| File location to which the index route will be rendered, (is resolved relative to `root`) |`path.join(publicDir, publicPath, '_spa.html')`|
78
-
|`server`|`boolean` or `object`| Settings for the Laravel testserver |*(see below)*|
79
-
|`dotEnvExport`|`boolean`| Whether the `NUXT_OUTPUT_PATH` varibale should be written to the `.env` file in the laravel root directory |`false`|
|`root`|`string`| Path to laravel directory (is resolved relative to `process.cwd()`) |`process.cwd()`|
75
+
|`publicDir`|`string`| The folder where laravel serves assets from (is resolved relative to `root`) |`'public'`|
76
+
|`outputPath`|`string`| File location to which an additional index route will be rendered, useful if you want to store it in a folder outside of Laravels public dir (is resolved relative to `root`) |`null`|
77
+
|`server`|`boolean` or `object`| Settings for the Laravel testserver |*(see below)*|
78
+
|`dotEnvExport`|`boolean`| Whether the `NUXT_OUTPUT_PATH` varibale should be written to the `.env` file in the laravel root directory |`false`|
80
79
81
80
The module loads the `.env` file from yout laravel root, so you can set the `NUXT_OUTPUT_PATH` environment variable from there.
82
81
@@ -90,10 +89,10 @@ Setting this to `true` is equivalient to omitting it and will simply use the def
90
89
|`host`|`string`| Hostname for the testserver |`nuxtConfig.server.host`|
91
90
|`port`|`number`| Port for the testserver |`nuxtConfig.server.port + 1`|
92
91
93
-
#### The `publicPath` setting
92
+
#### Path resolution inside `publicDir`
94
93
95
-
If `publicPath` is set manually and does not reside inside configured`publicDir`the module will be deactivated.
96
-
If `publicPath` is set manually and is valid `nuxtConfig.router.base` will be overwritten with the resolved URL.
94
+
If `nuxtConfig.router.base` is not set the SPA will be generated in the`publicDir`root with an index file name of `spa.html`.
95
+
If `nuxtConfig.router.base` is set the SPA will be generated in a corresponding location inside `publicDir`with the default index file name `index.html`.
97
96
98
97
## Laravel integration
99
98
@@ -112,14 +111,16 @@ Laravel integration is accomplished through two environment variables.
112
111
113
112
### Example scaffolding in existent Laravel application
2. Migrate all dependencies and scipts (most importantly `dev` and `build`) from `resources/nuxt/package.json` into `package.json` in Laravel root and delete it
122
-
3. Move all configuration files from `resources/nuxt` to Laravel root (or merge where appropiate, e.g. `.eslintrc.js`)
123
+
3. Move all configuration files from `resources/nuxt` to Laravel root (or merge where appropiate, e.g. `.editorconfig`)
123
124
4. Install the module and it's peer dependencies
124
125
125
126
```bash
@@ -130,9 +131,23 @@ Laravel integration is accomplished through two environment variables.
130
131
131
132
```js
132
133
module.exports= {
134
+
srcDir:'resources/nuxt',
133
135
mode:'spa',
134
-
// ...
135
-
modules: ['nuxt-laravel']
136
+
// ... other config
137
+
modules: [
138
+
'nuxt-laravel',
139
+
// ... other modules
140
+
]
141
+
}
142
+
```
143
+
144
+
6. (Optional) If you use jest, or other tools that reference the Nuxt root independently, you have to update thier respective configuration to make them work correctly.
145
+
Example `jest.config.js`:
146
+
147
+
```js
148
+
module.exports= {
149
+
rootDir:'resources/nuxt',
150
+
// ... other configurtion
136
151
}
137
152
```
138
153
@@ -189,7 +204,7 @@ Route::get(
189
204
190
205
Make sure nuxt path resolution of nuxt router corresponds to the defined routes.
191
206
192
-
> **IMPORTANT:** This example assumes the module option `publicPath` to have been set to `'app'`.
207
+
> **IMPORTANT:** This example assumes option `nuxtConfig.router.base` to have been set to `'/app/'`.
0 commit comments