8000 More options for baseUrl and outputDir settings in vue.config.js · Issue #1608 · vuejs/vue-cli · GitHub
[go: up one dir, main page]

Skip to content

More options for baseUrl and outputDir settings in vue.config.js #1608

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

Closed
taivu opened this issue Jun 18, 2018 · 6 comments
Closed

More options for baseUrl and outputDir settings in vue.config.js #1608

taivu opened this issue Jun 18, 2018 · 6 comments

Comments

@taivu
Copy link
taivu commented Jun 18, 2018

What problem does this feature solve?

allowing absolute url's and setting output file name

What does the proposed API look like?

from:

module.exports = {
  baseUrl: process.env.NODE_ENV === 'production'
    ? '/'
    : '/dist/',

  // where to output built files
  outputDir: 'dist'
}

to:

module.exports = {
  baseUrl: process.env.NODE_ENV === 'production'
    ? '/'
    : 'https://www.example.com.test:8080/dist/',

  // where to output built files
  output: {
    directory: 'dist',
    filename: 'not-app.js' // allow access to [hash]?
  }
}
@yyx990803
Copy link
Member

If you need to adjust filename just use webpack configurations.

@briancampo
Copy link

If you need to adjust filename just use webpack configurations.

@yyx990803 I'm not following your recommendation. I have a similar need and am getting outputDir is empty on build.

Are you suggesting to use vue > inspect to eject and edit that way?

@Akryum
Copy link
Member
Akryum commented Jun 23, 2018

@taivu
Copy link
Author
taivu commented Jun 23, 2018

@briancampo i ended up editing config passed from configureWebpack in vue.config.js.

@briancampo
Copy link

BLUF: could this be a RC3 (using RC3 here as well) issue as in #1496 comment this morning

@Akryum and @taivu, that is what I thought but am running into avoid modifying output directly error with the below. Also tried editing the config.plugins["VueLoaderPlugin"] with no luck either

     config.output.publicPath =
      process.env.NODE_ENV === "production"
        ? process.env.VAR1
          ? process.env.VAR2
          : "/main/"
        : "/";

    config.output.path =
      process.env.NODE_ENV === "production"
        ? process.env.VAR1
          ? process.env.VAR3
          : "/public/"
        : "/";

    config.output.filename = process.env.VAR4;

@taivu Sorry to be so dense; could you post what you ended up with

@taivu
Copy link
Author
taivu commented Jun 26, 2018

@briancampo This is what I ended up with for my needs.

module.exports = {
  configureWebpack: (config) => {
    config.output.filename = 'myApp.js'
    config.output.chunkFilename = '[name]'
    process.env.NODE_ENV === 'production'
      ? config.optimization.splitChunks.cacheGroups.vendors.name = 'vendors'
      : console.log(config) // dev does not have `optimization.splitChunks`
  },
}

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

4 participants
0