vue3.0 vue.config.js actual configuration

Today talk about vue-config.js configuration, as we build a good scaffold will find a lot less this version 2.x contrast, there is no build configuration, there is no webpack configuration, then the question is, how are we going to develop our the project does, such as setting agents, such as packaging configuration problem?

When vue cli3.0 projects need to configure additional parameters, you need to create the file 'vue.config.js', (this filename is fixed so written) , and package.json in the same directory.

= module.exports {
   // base path project deployment 
  // we assume that your default application will be deployed at the root of the domain name, 
  // such as https://www.my-app.com/ 
  // If your application deployed in a sub-path, then you need here 
  // specified child path. For example, if your application is deployed 
  // https://www.foobar.com/my-app/ 
  // then this value to `/ My-App /` 
  baseUrl: '/ Reader / dist /' ,  / * this is my preview of the online store at github project * /

   // the constructed output file where 
  outputDir: 'dist' , 

  // place to put static resources (JS / CSS / img / font / ...) 
  assetsDir : '' , 

  // for multiple-page configured, it is undefined 
  pages: { 
    index: { 
      // entry file 
      entry: 'src / main.js',  / * This is the root entry file * /
       // template file 
      Template: 'public / index.html' ,
       // output file 
      filename: 'index.html' ,
       // page title 
      title: 'Index Page' 
    }, 
    // abbreviated format 
    // template file public by default `/ subpage.html` 
    // If not, the public is` / index.html`. 
    // output file subpage.html` default is `. 
    subpage: 'src / main.js '    / * Note that this is * / 
  } 

  // whether the time saved using `eslint-loader` checked. 
  // Valid values: `ture` |` false` | `" error "` 
  // When set to `" error "`, check out the error will trigger compilation fails. 
  lintOnSave:, 

  // build the full version with an internal browser compiler 
  // checking https://cn.vuejs.org/v2/guide/installation.html# run - time compiler -vs- contains only run 
  runtimeCompiler: false , 

  // babel-Loader default skips node_modules dependence. 
  // explicitly dependent on a translation by this option. 
  transpileDependencies: [ / * String or regex * / ], 

  // whether to build generation source map for the production environment? 
  productionSourceMap: to true , 

  // adjust webpack internal configuration. 
  // Now https://github.com/vuejs/vue-docs-zh-cn/blob/master/vue-cli/webpack.md 
  chainWebpack: () => {}, 
  configureWebpack: () => {}, 

  //Related options CSS 
  CSS: {
     // the CSS in a separate component extracted CSS file (only in a production environment) 
    // may be passed to a `extract-text-webpack-plugin` options objects 
    extract: to true , 

    // whether to open the CSS source map? 
    sourceMap: false , 

    // pass custom options for the loader preprocessor. Such as to pass 
    // when sass-loader, using the `{sass: {...}} `. 
    loaderOptions: {}, 

    // for all open files and pretreatment CSS CSS Modules. 
    // This option does not affect `* .vue` file. 
    modules: to false 
  }, 

  // use `thread-loader` of Babel in a production environment and TypeScript 
  // default multi-core machine is turned on. 
  parallel: require ( 'os') cpus () length> 1.., 

  // options PWA plugin. 
  // Now https://github.com/vuejs/vue-docs-zh-cn/blob/master/vue-cli-plugin-pwa/README.md 
  PWA: {}, 

  // configuration webpack-dev-server behavior . 
  devserver: { 
    Open: process.platform === 'Darwin' , 
    Host: '0.0.0.0' , 
    Port: 8080 , 
    HTTPS: to false , 
    hotOnly: to false ,
     // Now https://github.com/vuejs/vue- docs-zh-cn / blob / master / vue-cli / cli-service.md # configure proxy 
    proxy: null , // String | Object 
    before: App =>  {}
  },

   // options tripartite plug 
  pluginOptions: {
     // ... 
  } 
}

Note : Notice above my thick blue mark, do the wrong change.

Then .gitignore remove / dist / can use npm run build packaged compilation and upload can be achieved https://root-lucas.github.io/Reader/dist/ online preview.

 

Guess you like

Origin www.cnblogs.com/jing-tian/p/11266796.html