Akryum / Akryum/vue-cli-plugin-ssr

Documentation around webpack configuration unclear

Aperta
#94 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
441
Fork
69
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**EDIT:** - I was running under 0.3.0 due to #57 not working, so I'm unblocked (although I'm having to go through some gymnastics in order to properly set the flag myself). I think this issue is still valid as a full vue.config.js would be more clear.

The documentation is unclear how exactly to leverage `VUE_CLI_SSR_TARGET` properly. It introduces a variable `api` that is unexplained. Could we expand the context to a full vue.config.js file that contains the necessary webpack configuration?

My use case is having a different URL used in a dockerized app -- the client bundle uses the full domain, while the server bundle uses the internal service name which is faster.

Here's my stripped down vue.config.js for reference:
```js
const path = require('path')
const fs = require('fs')
const express = require('express')

module.exports = {
devServer: {
port: 3000
},
pluginOptions: {
ssr: {
host: "0.0.0.0",
port: 3000,
// Entry for each target
entry: target => `./src/entry-${target}.ts`,
},
},
configureWebpack: config => {
console.log(`configure VUE_CLI_SSR_TARGET: ${process.env.VUE_CLI_SSR_TARGET}`)
return config;
},
chainWebpack: config => {
console.log(`chain VUE_CLI_SSR_TARGET: ${process.env.VUE_CLI_SSR_TARGET}`)
return config
}
}
```

And the console output:
```
yarn run v1.15.2
$ vue-cli-service ssr:build
chain VUE_CLI_SSR_TARGET: undefined
configure VUE_CLI_SSR_TARGET: undefined
chain VUE_CLI_SSR_TARGET: undefined
configure VUE_CLI_SSR_TARGET: undefined
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.