57 npm run build 和 npm run serve 的差异

前言

npm run serve 和 npm run build 的差异

这里主要是从 vue-cli 的流程 来看一下 我们经常用到的这两个命令, 他到传递给 webpack 打包的时候, 的一个具体的差异, 大致是配置了那些东西?

经过了那些流程 ?

 

 

vue-cli 的 vue-plugin 的加载

内置的 plugin 列表如下, 依次对应于左边的 commands, config 中的各个 js

也是在这个流程中, npm run serve 和 npm run build 产生了一些配置上的差异 导致了一部分结果的差异

2953f72fc17b4783917899015b7c70b2.png

 

 

vue-cli 的 vue-plugin 的加载导致的差异

更友好的这个json, 可以通过 vue-cli-service inspect 进行查看, 增加 --mode 参数查看不同的环境, 这里是直接调试输出的

npm run serve 执行得到的 webpack 的配置如下

{"mode": "development","context": "D:\\WebstormWorkStations\\hello-package","devtool": "eval-cheap-module-source-map","output": {"hashFunction": "xxhash64","path": "D:\\WebstormWorkStations\\hello-package\\dist","filename": "js/[name].js","publicPath": "","chunkFilename": "js/[name].js","globalObject": "(typeof self !== 'undefined' ? self : this)"},"resolve": {"alias": {"@": "D:\\WebstormWorkStations\\hello-package\\src","vue$": "vue/dist/vue.runtime.esm.js"},"extensions": [".mjs",".js",".jsx",".vue",".json",".wasm"],"modules": ["node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-service\\node_modules"]},"resolveLoader": {"modules": ["D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-plugin-babel\\node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-service\\lib\\config\\vue-loader-v15-resolve-compat","node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-service\\node_modules"]},"module": {"noParse": {},"rules": [{"test": {},"resolve": {"fullySpecified": false}},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\vue-loader-v15\\lib\\index.js","options": {"compilerOptions": {"whitespace": "condense"}}}]},{"test": {},"resourceQuery": {},"sideEffects": true},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "pug-plain-loader"}]},{"use": [{"loader": "raw-loader"},{"loader": "pug-plain-loader"}]}]},{"test": {},"type": "asset/resource","generator": {"filename": "img/[name].[hash:8][ext]"}},{"test": {},"type": "asset","generator": {"filename": "img/[name].[hash:8][ext]"}},{"test": {},"type": "asset","generator": {"filename": "media/[name].[hash:8][ext]"}},{"test": {},"type": "asset","generator": {"filename": "fonts/[name].[hash:8][ext]"}},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\vue-style-loader\\index.js","options": {"sourceMap": false,"shadowMode": false}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]}]},{"test": {},"exclude": [null],"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\babel-loader\\lib\\index.js","options": {"cacheCompression": false,"cacheDirectory": "D:\\WebstormWorkStations\\hello-package\\node_modules\\.cache\\babel-loader","cacheIdentifier": "66c7e3b9"}}]}]},"optimization": {"realContentHash": false,"splitChunks": {"cacheGroups": {"defaultVendors": {"name": "chunk-vendors","test": {},"priority": -10,"chunks": "initial"},"common": {"name": "chunk-common","minChunks": 2,"priority": -20,"chunks": "initial","reuseExistingChunk": true}}},"minimizer": [{"options": {"test": {},"extractComments": false,"parallel": true,"minimizer": {"options": {"compress": {"arrows": false,"collapse_vars": false,"comparisons": false,"computed_props": false,"hoist_funs": false,"hoist_props": false,"hoist_vars": false,"inline": false,"loops": false,"negate_iife": false,"properties": false,"reduce_funcs": false,"reduce_vars": false,"switches": false,"toplevel": false,"typeofs": false,"booleans": true,"if_return": true,"sequences": true,"unused": true,"conditionals": true,"dead_code": true,"evaluate": true},"mangle": {"safari10": true}}}}}]},"plugins": [{},{"definitions": {"process.env": {"NODE_ENV": "\"development\"","BASE_URL": "\"\""}}},{"options": {},"logger": {},"pathCache": {},"fsOperations": 0,"primed": false},{"compilationSuccessInfo": {},"shouldClearConsole": true,"formatters": [null,null,null,null],"transformers": [null,null,null,null],"previousEndTimes": {}},{"userOptions": {"title": "hello-package","scriptLoading": "defer","template": "D:\\WebstormWorkStations\\hello-package\\public\\index.html"},"version": 5,"options": {"template": "D:\\WebstormWorkStations\\hello-package\\public\\index.html","templateContent": false,"filename": "index.html","publicPath": "auto","hash": false,"inject": "head","scriptLoading": "defer","compile": true,"favicon": false,"minify": "auto","cache": true,"showErrors": true,"chunks": "all","excludeChunks": [],"chunksSortMode": "auto","meta": {},"base": false,"title": "hello-package","xhtml": false}},{"patterns": [{"from": "D:\\WebstormWorkStations\\hello-package\\public","to": "D:\\WebstormWorkStations\\hello-package\\dist","toType": "dir","noErrorOnMissing": true,"globOptions": {"ignore": ["**/.DS_Store","D:/WebstormWorkStations/hello-package/public/index.html"]},"info": {"minimized": true}}],"options": {}},{"delegate": {"profile": false,"modulesCount": 5000,"dependenciesCount": 10000,"showEntries": false,"showModules": true,"showDependencies": false,"showActiveModules": false,"percentBy": "entries"}}],"entry": {"app": ["./src/main.js"]}
}

 

npm run build 执行得到的 webpack 配置如下

{"mode": "production","context": "D:\\WebstormWorkStations\\hello-package","devtool": false,"output": {"hashFunction": "xxhash64","path": "D:\\WebstormWorkStations\\hello-package\\dist","filename": "js/[name].[contenthash:8].js","publicPath": "","chunkFilename": "js/[name].[contenthash:8].js"},"resolve": {"alias": {"@": "D:\\WebstormWorkStations\\hello-package\\src","vue$": "vue/dist/vue.runtime.esm.js"},"extensions": [".mjs",".js",".jsx",".vue",".json",".wasm"],"modules": ["node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-service\\node_modules"]},"resolveLoader": {"modules": ["D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-plugin-babel\\node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-service\\lib\\config\\vue-loader-v15-resolve-compat","node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules","D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\cli-service\\node_modules"]},"module": {"noParse": {},"rules": [{"test": {},"resolve": {"fullySpecified": false}},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\@vue\\vue-loader-v15\\lib\\index.js","options": {"compilerOptions": {"whitespace": "condense"}}}]},{"test": {},"resourceQuery": {},"sideEffects": true},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "pug-plain-loader"}]},{"use": [{"loader": "raw-loader"},{"loader": "pug-plain-loader"}]}]},{"test": {},"type": "asset/resource","generator": {"filename": "img/[name].[hash:8][ext]"}},{"test": {},"type": "asset","generator": {"filename": "img/[name].[hash:8][ext]"}},{"test": {},"type": "asset","generator": {"filename": "media/[name].[hash:8][ext]"}},{"test": {},"type": "asset","generator": {"filename": "fonts/[name].[hash:8][ext]"}},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "sass-loader","options": {"sourceMap": false,"sassOptions": {"indentedSyntax": true}}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "less-loader","options": {"sourceMap": false}}]}]},{"test": {},"oneOf": [{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2,"modules": {"localIdentName": "[name]_[local]_[hash:base64:5]"}}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]},{"resourceQuery": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]},{"test": {},"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]},{"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\mini-css-extract-plugin\\dist\\loader.js","options": {"publicPath": "../"}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\css-loader\\dist\\cjs.js","options": {"sourceMap": false,"importLoaders": 2}},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\postcss-loader\\dist\\cjs.js","options": {"sourceMap": false,"postcssOptions": {"plugins": [null]}}},{"loader": "stylus-loader","options": {"sourceMap": false}}]}]},{"test": {},"exclude": [null],"use": [{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\thread-loader\\dist\\cjs.js"},{"loader": "D:\\WebstormWorkStations\\hello-package\\node_modules\\babel-loader\\lib\\index.js","options": {"cacheCompression": false,"cacheDirectory": "D:\\WebstormWorkStations\\hello-package\\node_modules\\.cache\\babel-loader","cacheIdentifier": "47eee831"}}]}]},"optimization": {"realContentHash": false,"splitChunks": {"cacheGroups": {"defaultVendors": {"name": "chunk-vendors","test": {},"priority": -10,"chunks": "initial"},"common": {"name": "chunk-common","minChunks": 2,"priority": -20,"chunks": "initial","reuseExistingChunk": true}}},"minimizer": [{"options": {"test": {},"extractComments": false,"parallel": true,"minimizer": {"options": {"compress": {"arrows": false,"collapse_vars": false,"comparisons": false,"computed_props": false,"hoist_funs": false,"hoist_props": false,"hoist_vars": false,"inline": false,"loops": false,"negate_iife": false,"properties": false,"reduce_funcs": false,"reduce_vars": false,"switches": false,"toplevel": false,"typeofs": false,"booleans": true,"if_return": true,"sequences": true,"unused": true,"conditionals": true,"dead_code": true,"evaluate": true},"mangle": {"safari10": true}}}}},{"options": {"test": {},"parallel": true,"minimizer": {"options": {"preset": ["default",{"mergeLonghand": false,"cssDeclarationSorter": false}]}}}}]},"plugins": [{},{"definitions": {"process.env": {"NODE_ENV": "\"production\"","BASE_URL": "\"\""}}},{"options": {},"logger": {},"pathCache": {},"fsOperations": 0,"primed": false},{"compilationSuccessInfo": {},"shouldClearConsole": true,"formatters": [null,null,null,null],"transformers": [null,null,null,null],"previousEndTimes": {}},{"_sortedModulesCache": {},"options": {"filename": "css/[name].[contenthash:8].css","ignoreOrder": false,"runtime": true,"chunkFilename": "css/[name].[contenthash:8].css"},"runtimeOptions": {"linkType": "text/css"}},{"userOptions": {"title": "hello-package","scriptLoading": "defer","template": "D:\\WebstormWorkStations\\hello-package\\public\\index.html"},"version": 5,"options": {"template": "D:\\WebstormWorkStations\\hello-package\\public\\index.html","templateContent": false,"filename": "index.html","publicPath": "auto","hash": false,"inject": "head","scriptLoading": "defer","compile": true,"favicon": false,"minify": "auto","cache": true,"showErrors": true,"chunks": "all","excludeChunks": [],"chunksSortMode": "auto","meta": {},"base": false,"title": "hello-package","xhtml": false}},{"patterns": [{"from": "D:\\WebstormWorkStations\\hello-package\\public","to": "D:\\WebstormWorkStations\\hello-package\\dist","toType": "dir","noErrorOnMissing": true,"globOptions": {"ignore": ["**/.DS_Store","D:/WebstormWorkStations/hello-package/public/index.html"]},"info": {"minimized": true}}],"options": {}}],"entry": {"app": ["./src/main.js"]}
}

 

我们这里 只是从最终的结果来查看差异, 具体的细节 请参见各个 vue-plugin 的具体的实现

devtool 的默认配置, output 的文件模板存在一些差异

这也就是为什么我们在 npm run serve 的调试中, 看到的各个文件直接是 app.js, src_HelloWorld_vue.js 等等

e80983b03f1d4071892d11269c277aa2.png

 

css 的加载的 loader 有一些差异, npm run serve 是使用 vue-style-loader

npm run build直接使用 mini-css-extract-plugins 最小化目标 css

这里的每一个 test 是表示对于一类模块的加载方式, 只是这里的 test 没有加载出来, 可以理解为这个 test 是一个正则, 总共有十几类, 比如对于 *.vue 文件这样处理方式, *.css 另外的处理方式, 细节 我们不用关心

eb91dc089eac4b5e866efacede361396.png

 

optimization 里面 npm run build 多一个 minimizer 的流程

f09066def1244741b95e10362dc4dc06.png

 

npm run serve 这边多一些 dev 模式下面的一些配置

c040e88365b349fdb05324f51a6aa5b3.png

 

 

关于 plugin 的差异, 这部分的差异也可以在 各个 vue 插件中查找

如下是 npm run serve 的 plugin 列表

811f96a4c17848e9898d564821026635.png

 

如下是 npm run build 的 plugin 列表

0dcf848f7cd9471792677216bde1c180.png

 

比如之前曾经提到过的 CopyPlugin 的注册是在 app.js 中注册的

这个也曾经在 vue 项目默认暴露出去的 public 文件夹 和 CopyWebpackPlugin中提到 

525e0223d8fa4d5ca8e642e7416a9fc5.png

 

 

webpack 的其他上下文导致的差异

注意 这部分代码是在 webpack 里面, 不是在 vue-cli 中

比如, 我就听疑惑 npm run build 和 npm run serve 在哪里配置的一个最小化代码, 一个没有最小化代码? 这个问题 我找了很久, 最后终于找到了

在 webpack/lib/config.defaults.applyOptimizationDefaults 中, 一系列变量是 根据 isProduction 进行初始化的, 这就是为什么 npm run build 的流程中有 minimize 这一项

244a002d22bf44a0a138966d2cbbcb40.png

 

 

npm run serve 使用的内存文件系统, 而 npm run build 打包到磁盘的?

这个流程是由 npm run serve 这边的启动 devServer 的过程触发的

而 npm run build 这边和 devServer 没有关系, 因此 fs 是默认的 磁盘文件系统

26bb87c515714b058d93ad7831da72a0.png

 

具体的配置 outputFileSystem 到 context, compiler 的地方如下

然后可以看到, 这个 outputFileSystem 还是可以自己手动配置的, 扩展性相当强

2595b7b9e0834dea82172b4f4a65e5b1.png

 

 

npm run serve 如何将编译的结果写出到磁盘

其实偶尔也有 npm run servce 的时候, 查看一下具体文件的需求

免得 需要一个调试环境才能够运行时查看 memfs 的文件系统的具体的文件信息

这时候可以通过 devServer 下面的 devMiddleware 的配置进行配置, 增加了一个 writeToDisk 的选项, 这样的话 devServer 这边会将编译的结果, 也写出到内存文件系统, 然后也会写一份数据到磁盘, 服务本身的使用 还是使用 内存文件系统的数据

e57191fae9204ee09101505a58726a14.png

 

这里是通过 webpackDevMiddleware 这里进行关联的

c1eb1459e6be4692ba7196f4cdf4ca83.png

 

这是一份编译完成之后的结果如下

77bb18568fa447858495f6e9b6aff05d.png

 

另外可以通过 options.outputFileSystem 进行配置, 注意看下面 outputFileSystem 部分的配置

e810cfa645ea4ccb9ee757d64f032273.png

 

最终写出的文件信息如下

81057d8452c947c6859ca20dc2c1c1fc.png

 

writeToDisk 参数的文档

d0f3fb68fd8c46ffbb3872d01c6afcd1.png

 

outputFileSystem 参数的文档

8e045860028147bc92b724efe321dc16.png

 

 

完 

 

 

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/587737.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Oracle常用sql命令(新手)

1、备份单张表 创建复制表结构 create table employeesbak as select * from cims.employees 如果只复制表结构,只需要在结尾加上 where 10 插入数据 insert into employeesbak select * from cims.employees 删除一条数据 delete from…

Centos8/linux/虚拟机安装docker

docker分为ce版和ee版,像一般的小型团体和个人使用ce版就够了,别问为什么,问就是ee版收费。 1.首先切换到root用户 2.为确保安装时出现不必要的问题,先更新一下yum包 sudo yum update 3.如果之前安装过需要删除之间安装的CE版…

linux自动下载rpm的依赖包的方法

背景 rpm安装包是存在依赖关系的。通常在离线安装的时候,没有下全依赖包,安装就会失败。 分析 1.首先我们要使用yumdownloader来下载指定的包。 yumdownloader --disablerepo* --enablerepobase,epel,extras --releasever7 --archx86_64 --downloadd…

Flutter应用在苹果商店上架前的准备工作与注意事项

引言 🚀 Flutter作为一种跨平台的移动应用程序开发框架,为开发者提供了便利,使他们能够通过单一的代码库构建出高性能、高保真度的应用程序,同时支持Android和iOS两个平台。然而,完成Flutter应用程序的开发只是第一步…

Codeforces Round 932 (Div. 2) ---- E. Distance Learning Courses in MAC ---- 题解

E. Distance Learning Courses in MAC: 题目大意: 思路解析: // 对于这种二进制多个数计算答案,我们应该灵敏的想到是否可以通过枚举二进制位来计算答案。 就是对每一个查询找出或和的最大值,那我们想xi 和 yi中哪些…

爬虫 红网时刻 获取当月指定关键词新闻 并存储到CSV文件

目标网站:红网 爬取目的:为了获取某一地区更全面的在红网已发布的宣传新闻稿,同时也让自己的工作更便捷 环境:Pycharm2021,Python3.10, 安装的包:requests,csv,bs4&…

非关系型数据库(缓存数据库)redis的高可用(持久化)

目录 1.redis的高可用 2.Redis持久化 1.Redis 提供两种方式进行持久化 2.RDB持久化 2.1触发条件 2.1.1手动触发 2.1.2自动触发 2.1.3其他自动触发机制 2.2执行流程 ​编辑 2.3 启动时加载 3.AOF持久化 3.1开启AOF 3.2 执行流程 3.2.1append——命令追加 3.…

【OpenCV-颜色空间】

OpenCV-颜色空间 ■ RGB■ BGR■ HSV■ HSL■ HUE■ YUV ■ RGB ■ BGR BGR 就是RGB R和B调换位置。 OpenCV 默认使用BGR ■ HSV ■ HSL ■ HUE ■ YUV

Springboot集成knife4j (swagger)

1、添加依赖 在pom.xml 文件中添加 knife4j-spring-boot-starter 的依赖 <dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-spring-boot-starter</artifactId> <version>3.0.3</version> </depe…

【JavaScript】JS高级语法

目录 1.变量与函数 1.1作用域 1.2定义变量 1.3作用域链 1.4闭包 1.5预解析 1.6let提升 1.7函数参数 1.8箭头函数 2.解构赋值 3.1数组解构 3.2对象解构 3.对象 4.1字面量创建对象 4.2构造函数 4.2.1自定义构造函数 4.2.2静态成员和实例成员 4.数据类型 4.1引…

游戏引擎中的物理系统

一、物理对象与形状 1.1 对象 Actor 一般来说&#xff0c;游戏中的对象&#xff08;Actor&#xff09;分为以下四类&#xff1a; 静态对象 Static Actor动态对象 Dynamic Actor ---- 可能受到力/扭矩/冲量的影响检测器 TriggerKinematic Actor 运动学对象 ---- 忽略物理法则…

EFK(elasticsearch+filebeat+kibana)日志分析平台搭建

本文是记录一下EFK日志平台的搭建过程 项目背景&#xff1a; 此次搭建的日志分析平台主要是采集服务器上的java服务的log日志(输出的日志已经是json格式)&#xff0c;这些日志都已经按照不同环境输出到/home/dev /home/test1 /home/test2 目录下了&#xff0c;按照不同的应…