vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
4.43k stars 353 forks source link

New Vike setting `base` and only apply it to production by default #1794

Open brillout opened 3 months ago

brillout commented 3 months ago

Description

Supersede Vite's base setting with a new Vike setting base.

// vike.config.js

export default {
  // Applies only in production
  base: {
    server: '/some/base-url/',
    assets: 'http://localhost:8080/cdn/'
  },

  base: '/some/base-url/', // sets base.server (or base.assets as well?)
  base: 'http://localhost:8080/cdn/', // sets base.assets (and base.server as well?)

  // Applies also in dev
  base: {
    dev: true,
    value: '/some/base-url/'
  },

  // Mixed
  base: {
    server: {
      dev: true,
      value: '/some/base-url/'
    },
    assets: {
      dev: false,
      value: 'http://localhost:8080/cdn/'
    }
  }
}

Blocker: Vike CLI / vike.config.js.

See also: https://github.com/vikejs/vike/issues/1790