Skip to content

Documentation around webpack configuration unclear #94

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

Open
cmeyertons opened this issue Apr 11, 2019 · 1 comment
Open

Documentation around webpack configuration unclear #94

cmeyertons opened this issue Apr 11, 2019 · 1 comment

Comments

@cmeyertons
Copy link

cmeyertons commented Apr 11, 2019

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:

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
@chriscalo
Copy link
Contributor

I also found this unclear. Just proposed #142. Does that help with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants