Configuration
By default, after using the create
directive, the configuration file xbuild.config.js
will be automatically generated according to the options in the directory. Changing this file will allow more personality configuration for the project.
port
<Number> 8080
port
Change the devServer port number. The default is 8080 port.
open
<boolean> false
Browser
Automatically run the project using the default browser
entry
<Array>
Entry file
The entry files for index.js and index.[css/scss/less/styl] are set by default.
// example:
entry: [
'./src/scripts/index.js',
'./src/styles/index.[css/scss/less/styl]'
]
eslint
<boolean> Custom
Code Detection
If true is selected during initialization, code detection is turned on and can be set to false to close ESLint.
babel
<boolean> Custom
translater
It allows you to write new versions of JavaScript code that will still work in older browsers.
mobileLayout
<boolean> Custom
Adaptive layout
Whether to use adaptive layout.
designWidth
<Number> 750
Design draft size
Usually refers to the width of the design, in pixels (px).
base64
<Number> 8 * 1024
Static resources
Set the size of the static resource packaged with base64. The default is 8kb.
proxy
<Object>
cross-domain
When you encounter cross-domain problems during development, you can use this configuration, the configuration method reference [webpack-proxy] (https://webpack.docschina.org/configuration/dev-server/#devserver-proxy).
// example:
proxy: {
'/api': {
Target: '#',
pathRewrite: {
'^/api': ''
},
changeOrigin: true,
Secure: false
}
}