Configure you build

Warning: As a general rule, you should not mess with the build/ and config/ files. They are already set up for either Electron or the browser and you will most likely just f**k things up.

Note: You can see the previous warning as a "warranty void if seal is broken" notice.

If you need to build your app into a place outside its current directory, you can edit config/index.js.

Let's take a look at the default config/index.js:

var path = require('path')

module.exports = {
  build: {
    index: path.resolve(__dirname, 'dist/index.html'),
    assetsRoot: path.resolve(__dirname, 'dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    productionSourceMap: true
  },
  dev: {
    port: 8080,
    proxyTable: {}
  }
}

Inside the build section, we have the following options:

build.index

Must be an absolute path on your local file system.

This is where the index.html (with injected asset URLs) will be generated.

build.assetsRoot

Must be an absolute path on your local file system.

This should point to the root directory that contains all the static assets for your app.

build.assetsSubDirectory

Nest webpack-generated assets under this directory in build.assetsRoot, so that they are not mixed with other files you may have in build.assetsRoot. For example, if build.assetsRoot is /path/to/dist, and build.assetsSubDirectory is static, then all Webpack assets will be generated in path/to/dist/static.

This directory will be cleaned before each build, so it should only contain assets generated by the build.

Files inside static/ will be copied into this directory as-is during build. This means if you change this prefix, all your absolute URLs referencing files in static/ will also need to be changed. See Handling Static Assets for more details.

build.assetsPublicPath

This should be the URL path where your build.assetsRoot will be served. If you are working on a browser targetted app, this will probably be '/' (you might need a prefix depending on your back-end),

build.productionSourceMap

Whether to generate source maps for production build.

dev.port

Specify the port for the dev server to listen to.

dev.proxyTable

Define proxy rules for the dev server. See API Proxying During Development for more details.

results matching ""

    No results matching ""