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.mzph.cn/news/788459.shtml

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

相关文章

【Go】二十、反射

文章目录 1、反射2、对基本数据类型反射3、对结构体进行反射4、获取变量的类别5、通过反射修改基本类型变量的值6、通过反射操作结构体的属性和方法 1、反射 //核心包 import ("reflect")通过反射: 可以在运行时动态获取变量的类型、获取结构体的信息&a…

【二叉树】Leetcode 124. 二叉树中的最大路径和【困难】

二叉树中的最大路径和 二叉树中的 路径 被定义为一条节点序列,序列中每对相邻节点之间都存在一条边。同一个节点在一条路径序列中 至多出现一次 。该路径 至少包含一个 节点,且不一定经过根节点。 路径和 是路径中各节点值的总和。 给你一个二叉树的根…

【QT+QGIS跨平台编译】056:【pdal_json_schema+Qt跨平台编译】(一套代码、一套框架,跨平台编译)

点击查看专栏目录 文章目录 一、pdal_json_schema介绍二、pdal下载三、文件分析四、pro文件五、编译实践一、pdal_json_schema介绍 pdal_json_schema 是与 PDAL(Point Data Abstraction Library)相关的 JSON 模式文件。PDAL 是一个用于处理和分析点云数据的开源库。JSON 模式…

Flutter混淆方案对应用性能的影响分析与优化

在移动应用开发中,保护应用代码安全至关重要。Flutter 提供了简单易用的混淆工具,帮助开发者在构建 release 版本应用时有效保护代码。本文将介绍如何在 Flutter 应用中使用混淆,并提供了相关的操作步骤和注意事项。 📝 摘要 本…

【C++】lambda 表达式 / 包装器 / bind 绑定

目录 一. lambda 表达式1. lambda 表达式的语法1. lambda 表达式的使用2. lambda 表达式的捕捉列表 二. 包装器三. bind 绑定 一. lambda 表达式 Lambda 表达式是 C11 标准引入的一种新特性, 它提供了一种方便的方式来定义匿名函数. lambda 表达式实际上是一个匿名的仿函数; …

【FTP,EMail】

文章目录 FTPFTP:文件传输协议FTP: 控制连接与数据连接分开FTP命令、响应 EMail电子邮件(EMail)邮件服务器EMail: SMTP [RFC 2821]SMTP:总结 FTP FTP:文件传输协议 向远程主机上传输文件或从远程主机接收文件。客户/服…

使用tcpdump和wireshark进行服务器抓包分析

目录 前言 1.tcpdump简介 2.Wireshark简介 3.实际案例 4.代码示例 5.总结 前言 服务器抓包分析是一种非常常见和有效的网络故障排查和性能优化手段。通过捕获服务器上的网络流量,可以帮助我们深入了解服务器与其它设备之间的通信情况,发现问题并进…

Java多线程实战-从零手搓一个简易线程池(三)线程工厂,核心线程与非核心线程逻辑实现

🏷️个人主页:牵着猫散步的鼠鼠 🏷️系列专栏:Java全栈-专栏 🏷️本系列源码仓库:多线程并发编程学习的多个代码片段(github) 🏷️个人学习笔记,若有缺误,欢迎评论区指正…

Mac上怎么合并多张图片?

Mac上怎么合并多张图片?上班过的小伙伴都应该知道,合并拼接图片是一件非常重要且经常需要使用到的图片处理技术,将多张图片合并拼成一张之后能够展现出更多的图片内容。在Mac电脑上,合并多张图片是一项常见的任务,无论…

【教程】Kotlin语言学习笔记(六)——泛型

写在前面: 如果文章对你有帮助,记得点赞关注加收藏一波,利于以后需要的时候复习,多谢支持! 【Kotlin语言学习】系列文章 第一章 《认识Kotlin》 第二章 《数据类型》 第三章 《数据容器》 第四章 《方法》 第五章 《L…

关系型数据库设计

目录 1.数据库设计的重要性及定义 1.1 数据库设计的重要性 1.1.1 失败的数据库设计造成的后果 1.1.2 优秀的数据库设计带来的好处 1.2 数据库设计的定义 2.数据库需求分析 2.1 需求分析的步骤 2.1.1 收集信息 2.1.2 标识实体 2.1.3 标识每个实体的详细信息 2.1…

【HTML】制作一个简单的动态SVG图形

目录 前言 开始 HTML部分 CSS部分 效果图 总结 前言 无需多言,本文将详细介绍一段HTML和CSS代码,该代码用于创建一个动态的SVG图形,具体内容如下: 开始 首先新建文件夹,创建两个文本文档,其中HTML的文…

【2023】kafka原生以及配合springboot的使用(Kafka-3)

💻目录 前言 一、依赖二、原生使用kafka1、发送消息1.1、生产者同步发送消息1.2、生产者异步发送消息1.3、常用配置: 2、接收消息2.1、关于消费者的自动提交和手动提交2.2、长轮训poll消息2.3、消费者的健康状态检查2.4、指定分区和偏移量,时…

使用docker-tc对host容器进行限流

docker-tc是一个github开源项目,项目地址是https://github.com/lukaszlach/docker-tc。 运行docker-tc docker run -d \ --name docker-tc \ --network host \ --cap-add NET_ADMIN \ --restart always \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /var…

Transformer - model architecture

Transformer - model architecture flyfish Transformer总体架构可分为四个部分: 输⼊部分 输出部分 编码器部分 解码器部分 输入部分 输出部分 输⼊部分包含: 源嵌⼊层和位置编码 ⽬标嵌⼊层和位置编码 输出部分包含: 线性层 softmax处理器 左侧编码器部分和右侧解码器部…

微信小程序自定义弹窗组件

业务背景&#xff1a;弹窗有时字体较多&#xff0c;超过7个字&#xff0c;不适用wx.showToast. 组件代码 <view class"toast-box {{isShow? show:}}" animation"{{animationData}}"><view class"toast-content" ><view class&q…

Taro + vue3 小程序封装标题组件

分为没有跳转页面的title组件和 有跳转页面的title组件 我们可以把这个封装成一个组件 直接上代码 <template><div class"fixed-title-container"><div class"box"><div class"icon" v-if"isShow" click"…

【论文阅读】DETR 论文逐段精读

【论文阅读】DETR 论文逐段精读 文章目录 【论文阅读】DETR 论文逐段精读&#x1f4d6;DETR 论文精读【论文精读】&#x1f310;前言&#x1f4cb;摘要&#x1f4da;引言&#x1f9ec;相关工作&#x1f50d;方法&#x1f4a1;目标函数&#x1f4dc;模型结构⚙️代码 &#x1f4…

ubuntu-server部署hive-part4-部署hive

参照 https://blog.csdn.net/qq_41946216/article/details/134345137 操作系统版本&#xff1a;ubuntu-server-22.04.3 虚拟机&#xff1a;virtualbox7.0 部署hive 下载上传 下载地址 http://archive.apache.org/dist/hive/ apache-hive-3.1.3-bin.tar.gz 以root用户上传至…

多层PCB内部长啥样?

硬件工程师刚接触多层PCB的时候&#xff0c;很容易看晕。动辄十层八层的&#xff0c;线路像蜘蛛网一样。 画了几张多层PCB电路板内部结构图&#xff0c;用立体图形展示各种叠层结构的PCB图内部架构。 高密度互联板(HDI)的核心 在过孔 多层PCB的线路加工&#xff0c;和单层双…