在使用webpack进行 npm run build_devlopment的时候发生以下错误
package.json文件
{
"name": "web-auth-web",
"version": "1.0.0",
"description": "",
"scripts": {
"build_devlopment": "webpack --env.development",
"build_production": "webpack --env.production"
},
"dependencies": {
"bootstrap": "^4.3.1",
"jquery": "^3.4.1",
"particles.js": "^2.0.0",
"popper.js": "^1.15.0",
"vue": "^2.6.10",
"vue-router": "^3.1.2",
"vue-toast-notification": "0.0.2"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"autoprefixer": "^9.5.1",
"babel-loader": "^8.0.5",
"css-loader": "^2.1.1",
"cssnano": "^4.1.10",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^3.0.1",
"html-webpack-plugin": "^4.0.0-beta.5",
"html-withimg-loader": "^0.1.16",
"mini-css-extract-plugin": "^0.6.0",
"node-sass": "^4.12.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"url-loader": "^1.1.2",
"vue-loader": "^15.4.2",
"vue-template-compiler": "^2.5.21",
"webpack": "^4.30.0",
"webpack-cleanup-plugin": "^0.5.1",
"webpack-cli": "^3.3.1",
"webpack-plugin-hash-output": "^3.2.1"
},
"author": "LinTx",
"license": "ISC",
"private": true
}
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
尝试新的跨平台 PowerShell https://aka.ms/pscore6
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm run build_devlopment
Debugger attached.
> web-auth-web@1.0.0 build_devlopment D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource
> webpack --env.development
Debugger attached.
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
(node:8196) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
WebpackCleanupPlugin: 0 file(s) deleted.
Hash: c58ac5470f55250197b9
Version: webpack 4.46.0
Time: 2994ms
Built at: 2022-08-25 13:19:38
Asset Size Chunks Chunk Names
./\index.html 712 bytes [emitted]
static/css/index.css 283 KiB index [emitted] index
static/css/index.css.map 354 KiB index [emitted] [dev] index
static/js/common.vendor~index.js 1.02 MiB vendor~index [emitted] vendor~index
static/js/common.vendor~index.js.map 1.25 MiB vendor~index [emitted] [dev] vendor~index
static/js/index.js 95.2 KiB index [emitted] index
static/js/index.js.map 84.3 KiB index [emitted] [dev] index
Entrypoint index = static/js/common.vendor~index.js static/js/common.vendor~index.js.map static/css/index.css static/js/index.js static/css/index.css.map static/js/index.js.map
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {vendor~index} [built]
[./src/static/css/index.scss] 39 bytes {index} [built]
[./src/static/js/index.js] 2.07 KiB {index} [built]
[./src/static/vue/changePassword.vue] 1.15 KiB {index} [built]
[./src/static/vue/changePassword.vue?vue&type=script&lang=js&] 394 bytes {index} [built]
[./src/static/vue/changePassword.vue?vue&type=template&id=b8ae3968&] 262 bytes {index} [built]
[./src/static/vue/changePlayerName.vue] 917 bytes {index} [built]
[./src/static/vue/changePlayerName.vue?vue&type=script&lang=js&] 398 bytes {index} [built]
[./src/static/vue/help.vue] 1.01 KiB {index} [built]
[./src/static/vue/help.vue?vue&type=template&id=6a184c62&] 252 bytes {index} [built]
[./src/static/vue/index.vue] 1.01 KiB {index} [built]
[./src/static/vue/index.vue?vue&type=template&id=5e1b3081&] 253 bytes {index} [built]
[./src/static/vue/login.vue] 1.11 KiB {index} [built]
[./src/static/vue/me.vue] 1.09 KiB {index} [built]
[./src/static/vue/register.vue] 893 bytes {index} [built]
+ 42 hidden modules
ERROR in ./src/static/vue/login.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/login.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/login.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/login.vue?vue&type=script&lang=js&) 1:0-41 14:6-13 25:6-13
@ ./src/static/vue/login.vue?vue&type=script&lang=js&
@ ./src/static/vue/login.vue
@ ./src/static/js/index.js
ERROR in ./src/static/vue/register.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/register.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/register.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/register.vue?vue&type=script&lang=js&) 3:0-41 20:6-13
@ ./src/static/vue/register.vue?vue&type=script&lang=js&
@ ./src/static/vue/register.vue
@ ./src/static/js/index.js
ERROR in ./src/static/vue/me.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/me.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/me.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/me.vue?vue&type=script&lang=js&) 1:0-41 14:6-13 19:6-13 20:16-23 28:14-21 34:6-13
@ ./src/static/vue/me.vue?vue&type=script&lang=js&
@ ./src/static/vue/me.vue
@ ./src/static/js/index.js
ERROR in ./src/static/vue/changePassword.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/changePassword.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/changePassword.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/changePassword.vue?vue&type=script&lang=js&) 2:0-41 20:6-13
@ ./src/static/vue/changePassword.vue?vue&type=script&lang=js&
@ ./src/static/vue/changePassword.vue
@ ./src/static/js/index.js
ERROR in ./src/static/vue/changePlayerName.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/changePlayerName.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/changePlayerName.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/changePlayerName.vue?vue&type=script&lang=js&) 3:0-41 20:6-13
@ ./src/static/vue/changePlayerName.vue?vue&type=script&lang=js&
@ ./src/static/vue/changePlayerName.vue
@ ./src/static/js/index.js
ERROR in ./src/static/vue/openChangePlayerName.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/openChangePlayerName.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/openChangePlayerName.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/openChangePlayerName.vue?vue&type=script&lang=js&) 1:0-41 12:6-13 19:24-31
@ ./src/static/vue/openChangePlayerName.vue?vue&type=script&lang=js&
@ ./src/static/vue/openChangePlayerName.vue
@ ./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/changePlayerName.vue?vue&type=script&lang=js&
@ ./src/static/vue/changePlayerName.vue?vue&type=script&lang=js&
@ ./src/static/vue/changePlayerName.vue
@ ./src/static/js/index.js
ERROR in ./src/static/vue/openRegister.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/openRegister.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
@ ./src/static/vue/openRegister.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/openRegister.vue?vue&type=script&lang=js&) 2:0-41 21:6-13
@ ./src/static/vue/openRegister.vue?vue&type=script&lang=js&
@ ./src/static/vue/openRegister.vue
@ ./node_modules/babel-loader/lib??ref--0!./node_modules/vue-loader/lib??vue-loader-options!./src/static/vue/register.vue?vue&type=script&lang=js&
@ ./src/static/vue/register.vue?vue&type=script&lang=js&
@ ./src/static/vue/register.vue
@ ./src/static/js/index.js
ERROR in ./src/static/js/index.js
Module not found: Error: Can't resolve './libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\js'
@ ./src/static/js/index.js 4:0-37 62:4-11 73:4-11 74:10-17 84:8-15
Child HtmlWebpackCompiler:
1 asset
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/html-webpack-plugin/lib/loader.js!./src/html/index.html] 501 bytes {HtmlWebpackPlugin_0} [built]
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/postcss-loader/src/index.js??ref--1-2!node_modules/sass-loader/dist/cjs.js!src/static/css/index.scss:
Entrypoint mini-css-extract-plugin = *
[./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??ref--1-2!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss 292 KiB {mini-css-extract-plugin} [built]
+ 1 hidden module
Waiting for the debugger to disconnect...
npm ERR! errno 2
npm ERR! web-auth-web@1.0.0 build_devlopment: `webpack --env.development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the web-auth-web@1.0.0 build_devlopment script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
Waiting for the debugger to disconnect...
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm uni vue-loader vue-template-compiler -D
Debugger attached.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
removed 17 packages in 5.073s
Waiting for the debugger to disconnect...
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm i vue-loader@13.3.0 vue-template-compiler@2.5.2 -D
npm WARN deprecated flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ vue-template-compiler@2.5.2
+ vue-loader@13.3.0
added 24 packages from 22 contributors and updated 2 packages in 15.736s
Waiting for the debugger to disconnect...
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm run build_devlopment
Debugger attached.
> web-auth-web@1.0.0 build_devlopment D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource
> webpack --env.development
Debugger attached.
Waiting for the debugger to disconnect...
D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\cli.js:93
throw err;
^
Error: Cannot find module 'vue-loader/lib/plugin'
Require stack:
- D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\webpack.config.js
- D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\utils\convert-argv.js
- D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\cli.js
- D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack\bin\webpack.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at Object. (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\webpack.config.js:9:25)
at Module._compile (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
at requireConfig (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
at D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
at Array.forEach ()
at module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
at D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\cli.js:71:45
at Object.parse (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\yargs\yargs.js:576:18)
at D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\cli.js:49:8
at Object. (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack-cli\bin\cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32)
at Function.Module._load (internal/modules/cjs/loader.js:727:14)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object. (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\webpack\bin\webpack.js:156:2)
at Module._compile (internal/modules/cjs/loader.js:959:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
at Module.load (internal/modules/cjs/loader.js:815:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'D:\\SystemDefault\\Desktop\\wj\\Minecraft-Plugin-WebAuth-master\\websource\\webpack.config.js',
'D:\\SystemDefault\\Desktop\\wj\\Minecraft-Plugin-WebAuth-master\\websource\\node_modules\\webpack-cli\\bin\\utils\\convert-argv.js',
'D:\\SystemDefault\\Desktop\\wj\\Minecraft-Plugin-WebAuth-master\\websource\\node_modules\\webpack-cli\\bin\\cli.js',
'D:\\SystemDefault\\Desktop\\wj\\Minecraft-Plugin-WebAuth-master\\websource\\node_modules\\webpack\\bin\\webpack.js'
]
}
npm ERR! errno 1
npm ERR! web-auth-web@1.0.0 build_devlopment: `webpack --env.development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the web-auth-web@1.0.0 build_devlopment script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodes\node_cache\_logs\2022-08-25T05_23_28_166Z-debug.log
Waiting for the debugger to disconnect...
Debugger attached.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ vue-loader@15.4.2
+ vue-template-compiler@2.5.21
added 6 packages from 7 contributors, removed 13 packages and updated 5 packages in 24.545s
Waiting for the debugger to disconnect...
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm run build_devlopment
Debugger attached.
> web-auth-web@1.0.0 build_devlopment D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource
> webpack --env.development
Debugger attached.
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
(node:7400) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
WebpackCleanupPlugin: 0 file(s) deleted.
Hash: 23d31144009ddecd9730
Version: webpack 4.46.0
Time: 2290ms
Built at: 2022-08-25 13:31:53
Asset Size Chunks Chunk Names
./\index.html 712 bytes [emitted]
static/css/index.css 283 KiB index [emitted] index
static/css/index.css.map 354 KiB index [emitted] [dev] index
static/js/common.vendor~index.js 1.02 MiB vendor~index [emitted] vendor~index
static/js/common.vendor~index.js.map 1.25 MiB vendor~index [emitted] [dev] vendor~index
static/js/index.js 18.7 KiB index [emitted] index
static/js/index.js.map 11.2 KiB index [emitted] [dev] index
Entrypoint index = static/js/common.vendor~index.js static/js/common.vendor~index.js.map static/css/index.css static/js/index.js static/css/index.css.map static/js/index.js.map
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {vendor~index} [built]
[./src/static/css/index.scss] 39 bytes {index} [built]
[./src/static/js/index.js] 2.07 KiB {index} [built]
[./src/static/vue/changePassword.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/changePlayerName.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/help.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/index.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/login.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/me.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/register.vue] 544 bytes {index} [built] [failed] [1 error]
+ 10 hidden modules
ERROR in ./src/static/vue/login.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 7:0-41 25:13-22
ERROR in ./src/static/vue/index.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 8:0-41 97:13-22
ERROR in ./src/static/vue/register.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 9:0-47 29:13-25
ERROR in ./src/static/vue/help.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 10:0-39 33:13-21
ERROR in ./src/static/vue/me.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 11:0-35 21:13-19
ERROR in ./src/static/vue/changePlayerName.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 13:0-63 41:13-33
ERROR in ./src/static/vue/changePassword.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 12:0-59 37:13-31
ERROR in ./src/static/js/index.js
Module not found: Error: Can't resolve './libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\js'
@ ./src/static/js/index.js 4:0-37 62:4-11 73:4-11 74:10-17 84:8-15
Child HtmlWebpackCompiler:
1 asset
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/html-webpack-plugin/lib/loader.js!./src/html/index.html] 501 bytes {HtmlWebpackPlugin_0} [built]
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/postcss-loader/src/index.js??ref--1-2!node_modules/sass-loader/dist/cjs.js!src/static/css/index.scss:
Entrypoint mini-css-extract-plugin = *
[./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??ref--1-2!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss 292 KiB {mini-css-extract-plugin} [built]
+ 1 hidden module
Waiting for the debugger to disconnect...
npm ERR! errno 2
npm ERR! web-auth-web@1.0.0 build_devlopment: `webpack --env.development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the web-auth-web@1.0.0 build_devlopment script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodes\node_cache\_logs\2022-08-25T05_31_54_085Z-debug.log
Waiting for the debugger to disconnect...
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm run build_devlopment
Debugger attached.
> web-auth-web@1.0.0 build_devlopment D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource
> webpack --env.development
Debugger attached.
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
(node:15264) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
WebpackCleanupPlugin: 0 file(s) deleted.
Hash: 23d31144009ddecd9730
Version: webpack 4.46.0
Time: 2372ms
Built at: 2022-08-25 13:37:49
Asset Size Chunks Chunk Names
./\index.html 712 bytes [emitted]
static/css/index.css 283 KiB index [emitted] index
static/css/index.css.map 354 KiB index [emitted] [dev] index
static/js/common.vendor~index.js 1.02 MiB vendor~index [emitted] vendor~index
static/js/common.vendor~index.js.map 1.25 MiB vendor~index [emitted] [dev] vendor~index
static/js/index.js 18.7 KiB index [emitted] index
static/js/index.js.map 11.2 KiB index [emitted] [dev] index
Entrypoint index = static/js/common.vendor~index.js static/js/common.vendor~index.js.map static/css/index.css static/js/index.js static/css/index.css.map static/js/index.js.map
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {vendor~index} [built]
[./src/static/css/index.scss] 39 bytes {index} [built]
[./src/static/js/index.js] 2.07 KiB {index} [built]
[./src/static/vue/changePassword.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/changePlayerName.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/help.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/index.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/login.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/me.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/register.vue] 544 bytes {index} [built] [failed] [1 error]
+ 10 hidden modules
ERROR in ./src/static/vue/index.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 8:0-41 97:13-22
ERROR in ./src/static/vue/login.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 7:0-41 25:13-22
ERROR in ./src/static/vue/help.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 10:0-39 33:13-21
ERROR in ./src/static/vue/me.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 11:0-35 21:13-19
ERROR in ./src/static/vue/register.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 9:0-47 29:13-25
ERROR in ./src/static/vue/changePlayerName.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 13:0-63 41:13-33
ERROR in ./src/static/vue/changePassword.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 12:0-59 37:13-31
ERROR in ./src/static/js/index.js
Module not found: Error: Can't resolve './libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\js'
@ ./src/static/js/index.js 4:0-37 62:4-11 73:4-11 74:10-17 84:8-15
Child HtmlWebpackCompiler:
1 asset
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/html-webpack-plugin/lib/loader.js!./src/html/index.html] 501 bytes {HtmlWebpackPlugin_0} [built]
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/postcss-loader/src/index.js??ref--1-2!node_modules/sass-loader/dist/cjs.js!src/static/css/index.scss:
Entrypoint mini-css-extract-plugin = *
[./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??ref--1-2!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss 292 KiB {mini-css-extract-plugin} [built]
+ 1 hidden module
Waiting for the debugger to disconnect...
PS D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource> npm run build_devlopment
Debugger attached.
> web-auth-web@1.0.0 build_devlopment D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource
> webpack --env.development
Debugger attached.
Replace Autoprefixer browsers option to Browserslist config.
Use browserslist key in package.json or .browserslistrc file.
Using browsers option can cause errors. Browserslist config
can be used for Babel, Autoprefixer, postcss-normalize and other tools.
If you really need to use option, rename it to overrideBrowserslist.
Learn more at:
https://github.com/browserslist/browserslist#readme
https://twitter.com/browserslist
(node:7548) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
WebpackCleanupPlugin: 0 file(s) deleted.
Hash: 23d31144009ddecd9730
Version: webpack 4.46.0
Time: 2197ms
Built at: 2022-08-25 13:40:23
Asset Size Chunks Chunk Names
./\index.html 712 bytes [emitted]
static/css/index.css 283 KiB index [emitted] index
static/css/index.css.map 354 KiB index [emitted] [dev] index
static/js/common.vendor~index.js 1.02 MiB vendor~index [emitted] vendor~index
static/js/common.vendor~index.js.map 1.25 MiB vendor~index [emitted] [dev] vendor~index
static/js/index.js 18.7 KiB index [emitted] index
static/js/index.js.map 11.2 KiB index [emitted] [dev] index
Entrypoint index = static/js/common.vendor~index.js static/js/common.vendor~index.js.map static/css/index.css static/js/index.js static/css/index.css.map static/js/index.js.map
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {vendor~index} [built]
[./src/static/css/index.scss] 39 bytes {index} [built]
[./src/static/js/index.js] 2.07 KiB {index} [built]
[./src/static/vue/changePassword.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/changePlayerName.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/help.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/index.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/login.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/me.vue] 544 bytes {index} [built] [failed] [1 error]
[./src/static/vue/register.vue] 544 bytes {index} [built] [failed] [1 error]
+ 10 hidden modules
ERROR in ./src/static/vue/login.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 7:0-41 25:13-22
ERROR in ./src/static/vue/index.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 8:0-41 97:13-22
ERROR in ./src/static/vue/register.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 9:0-47 29:13-25
ERROR in ./src/static/vue/changePassword.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 12:0-59 37:13-31
ERROR in ./src/static/vue/help.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 10:0-39 33:13-21
ERROR in ./src/static/vue/me.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 11:0-35 21:13-19
ERROR in ./src/static/vue/changePlayerName.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:21:11)
at Object.module.exports (D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\node_modules\vue-loader\lib\index.js:65:35)
@ ./src/static/js/index.js 13:0-63 41:13-33
ERROR in ./src/static/js/index.js
Module not found: Error: Can't resolve './libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\js'
@ ./src/static/js/index.js 4:0-37 62:4-11 73:4-11 74:10-17 84:8-15
Child HtmlWebpackCompiler:
1 asset
Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
[./node_modules/html-webpack-plugin/lib/loader.js!./src/html/index.html] 501 bytes {HtmlWebpackPlugin_0} [built]
Child mini-css-extract-plugin node_modules/css-loader/dist/cjs.js!node_modules/postcss-loader/src/index.js??ref--1-2!node_modules/sass-loader/dist/cjs.js!src/static/css/index.scss:
Entrypoint mini-css-extract-plugin = *
[./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src/index.js?!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss] ./node_modules/css-loader/dist/cjs.js!./node_modules/postcss-loader/src??ref--1-2!./node_modules/sass-loader/dist/cjs.js!./src/static/css/index.scss 292 KiB {mini-css-extract-plugin} [built]
+ 1 hidden module
Waiting for the debugger to disconnect...
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! web-auth-web@1.0.0 build_devlopment: `webpack --env.development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the web-auth-web@1.0.0 build_devlopment script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodes\node_cache\_logs\2022-08-25T05_40_23_215Z-debug.log
Waiting for the debugger to disconnect...
'use strict';
const fs = require('fs');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackCleanupPlugin = require('webpack-cleanup-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const WebPack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
//会编译的html文件后缀
const htmlExtensions = ['.html','.htm','.tpl'];
const host = {
dev:'/bungeewebauth/',
dis:'/bungeewebauth/'
};
//目录配置
const paths = {
root:{
//开发环境输出根目录
dev:path.resolve(__dirname, '../../../minecraft.node.js/bungeecord-server/plugins/WebAuth/web'),
//生产环境输出根目录
dis:path.resolve(__dirname, '../src/main/resources/web'),
//源码文件根目录
src:path.resolve(__dirname, './src')
},
outpath:{
//输出的js文件目录
js:'static/js/',
//输出的图片文件目录
img:'static/img/',
//输出的字体文件目录
font:'static/fonts/',
//输出的css文件目录
css:'static/css/',
//输出的模版文件目录
html:''
},
srcpath:{
//js源码文件所在目录
js:'static/js/',
//模版源码文件所在目录
html:'html'
}
};
module.exports = function (env, argv) {
let mode = 'development';
let development = true;
if (typeof env === 'object' && env.hasOwnProperty('production') && env.production === true) {
mode = 'production';
development = false;
}
let publicPath = development?host.dev:host.dis;
let webpackConfig = {
// mode: 'none',//"production" | "development" | "none"
mode: mode,
entry: {},//具体内容由后面编写的脚本填充
output: {
//输出文件根目录,绝对路径
path: development?paths.root.dev:paths.root.dis,
//输出文件名
filename: paths.outpath.js+'[name].js',
//sourcemap输出文件名
//[file]:生成后的js文件名(包括路径),[filebase]:生成后的js文件名(不包括路径)
sourceMapFilename: '[file].map',
//chunk文件输出文件名
chunkFilename:paths.outpath.js+'common.[id].js',
// publicPath: 相对目录,可以使用cdn地址(开发环境不设置等)
publicPath:publicPath
},
//优化选项
optimization:{
splitChunks:{
cacheGroups:{
//公共模块配置
commons:{
//对导入方式的设置,'async':只管动态导入的,'initial':只管静态导入的,'all':所有的
//静态导入:import 'xxx',动态导入:import('xxx')
chunks: 'all',
//有2个chunk使用才切分到公共文件中
minChunks:2,
//最大并发数,简单理解为一个entry及包含的文件最多被拆分成多少个chunk
maxInitialRequests:5,
//0以上的大小就会切分chunk
minSize:0,
// name:'[chunkhash]'//影响文件名、sourcemap文件名、其他地方引用的chunk的name
// filename:paths.outpath.js+'common.js'
},
vendor:{
test:/[\\/]node_modules[\\/]/i,
chunks:'all',
priority:10,
enforce:true
}
}
}
},
module: {
rules: [
{
//对ES6语法进行编译
test: /\.js$/i,
exclude:/[\\/]node_modules[\\/]/i,
loader:'babel-loader',
options:{
presets:['@babel/preset-env']
}
},
{
//css文件的处理
test: /\.(css|scss)$/i,
use : [
//使用插件将css文件提取为单独的文件
MiniCssExtractPlugin.loader,
//css解析需要的配置
'css-loader',
// 处理CSS压缩、@import等需要的配置
{
loader: 'postcss-loader',
options: {
plugins: [
require('postcss-import')(),
//自动添加fixer(比如--webkit-等)
require('autoprefixer')({
browsers: ['last 30 versions', "> 2%", "Firefox >= 10", "ie 6-11"]
})
]
}
},
//处理sass
'sass-loader',
]
},
{
//css中图片的处理
test: /\.(png|svg|jpg|gif)$/i,
use:[
{
//使用urlloader将图片自动转换成base64/文件
loader:'url-loader',
options:{
//文件名
name:paths.outpath.img+'[name].[ext]',
//单独的publicpath
publicPath:publicPath,
// outputPath:path.resolve(__dirname, development?'./output/dev':'./output/dis'),
//base64/文件的文件大小界限(K)
limit:200
}
}
]
},
{
test:/\.(woff|woff2|eot|ttf|otf|svg)$/i,
use:[
{
loader:'file-loader',
options:{
name:paths.outpath.font+'[name].[ext]',
publicPath:publicPath,
limit: 0
}
}
]
},
{
//处理html文件中的资源文件,比如图片,提取后匹配上面的图片test,然后由urlloader处理
test:/\.(html)$/i,
use:['html-withimg-loader']
},
{
test: /.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
//css单独打包插件
new MiniCssExtractPlugin({filename:paths.outpath.css+'[id].css'}),
//打包前用于清空 output 目录
new WebpackCleanupPlugin(),
//全局使用jq
new WebPack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}),
new VueLoaderPlugin()
],
// devtool 更详细的资料:https://segmentfault.com/a/1190000008315937
devtool: 'source-map'
};
if (!development) {
//生产模式配置CSS压缩
webpackConfig.plugins.push(new OptimizeCSSAssetsPlugin({
assetNameRegExp: /\.css$/g,
cssProcessor: require('cssnano'),
// cssProcessorOptions: cssnanoOptions,
cssProcessorPluginOptions: {
preset: ['default', {
discardComments: {
removeAll: true,
},
normalizeUnicode: false
}]
},
canPrint: true
}));
}
//批量遍历寻找html文件,然后寻找对应的js文件,并添加到webpack config中
let addhtml = (root,sub)=>{
let p = path.resolve(root,paths.srcpath.html,sub);
//读取子目录文件列表
let f = fs.readdirSync(p);
f.forEach(file=>{
let child = path.resolve(p,file); //文件/文件夹绝对路径
let stats = fs.statSync(child); //文件/文件夹状态
if (stats.isDirectory()) {
//是目录,遍历子目录
addhtml(root,sub + path.sep + file);
}
else {
let extension = path.extname(file);
//只处理指定后缀的文件
if (htmlExtensions.indexOf(extension.toLocaleString())===-1) {
return;
}
//获取不带后缀的文件名
let name = file.substring(0,file.lastIndexOf(extension));
//组装对应的js文件的绝对路径
let js = path.resolve(root,paths.srcpath.js,sub,name+'.js');
//对应的js文件存在,则添加进entry
if (fs.existsSync(js) && fs.statSync(js).isFile()) {
webpackConfig.entry[name] = js;
}
//添加htmlwebpackplugin配置
webpackConfig.plugins.push(new HtmlWebpackPlugin({
//输出文件名
filename: paths.outpath.html + sub + path.sep + name + extension,
//模板文件(源文件)
template: child,
//插入的内容在哪里(true|'head'|'body'|false)
inject: true,
//是否闭合link标签(xhtml标准)
xhtml: true,
//在插入的js、css标签后面加上hash
hash: true,
//这个html文件中插入的chunks,3.x版本的插件不能处理common chunk,4.x版本可以自动处理
chunks: [name]
}));
}
})
};
addhtml(paths.root.src,'./');
return webpackConfig;
};
建议你看下这篇博客vue+webpack配置多环境打包Module not found: Error: Can't resolve '../js/libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\vue'
Module not found: Error: Can't resolve './libs/session' in 'D:\SystemDefault\Desktop\wj\Minecraft-Plugin-WebAuth-master\websource\src\static\js'
文件路径引入不正确,或者文件不存在