The 'mode' option has not been set, webpack will fallback to 'production' for th is value

我会带着你远行 2022-05-23 04:27 243阅读 0赞

1、错误描述

  1. C:\Users\Administrator>cd cma
  2. C:\Users\Administrator\cma>webpack you.js today.js
  3. Hash: 39919aae8cb041a7549f
  4. Version: webpack 4.10.2
  5. Time: 588ms
  6. Built at: 2018-06-01 21:01:06
  7. 1 asset
  8. Entrypoint main = main.js
  9. [0] ./you.js 288 bytes {0} [built]
  10. [1] multi ./you.js today.js 40 bytes {0} [built]
  11. WARNING in configuration
  12. The 'mode' option has not been set, webpack will fallback to 'production' for th
  13. is value. Set 'mode' option to 'development' or 'production' to enable defaults
  14. for each environment.
  15. You can also set it to 'none' to disable any default behavior. Learn more: https
  16. ://webpack.js.org/concepts/mode/
  17. ERROR in multi ./you.js today.js
  18. Module not found: Error: Can't resolve 'today.js' in 'C:\Users\Administrator\cma
  19. '
  20. @ multi ./you.js today.js
  21. C:\Users\Administrator\cma>webpack you.js today.js
  22. Hash: 2ffa3d7e0a8a6e808dda
  23. Version: webpack 4.10.2
  24. Time: 613ms
  25. Built at: 2018-06-01 21:11:11
  26. Asset Size Chunks Chunk Names
  27. main.js 1.1 KiB 0 [emitted] main
  28. Entrypoint main = main.js
  29. [0] ./today.js 0 bytes {0} [built]
  30. [1] ./you.js 288 bytes {0} [built]
  31. [2] multi ./you.js ./today.js 40 bytes {0} [built]
  32. WARNING in configuration
  33. The 'mode' option has not been set, webpack will fallback to 'production' for th
  34. is value. Set 'mode' option to 'development' or 'production' to enable defaults
  35. for each environment.
  36. You can also set it to 'none' to disable any default behavior. Learn more: https
  37. ://webpack.js.org/concepts/mode/
  38. C:\Users\Administrator\cma>webpack you.js today.js
  39. Hash: 2ffa3d7e0a8a6e808dda
  40. Version: webpack 4.10.2
  41. Time: 156ms
  42. Built at: 2018-06-01 21:13:04
  43. Asset Size Chunks Chunk Names
  44. main.js 1.1 KiB 0 [emitted] main
  45. Entrypoint main = main.js
  46. [0] ./today.js 0 bytes {0} [built]
  47. [1] ./you.js 288 bytes {0} [built]
  48. [2] multi ./you.js ./today.js 40 bytes {0} [built]
  49. WARNING in configuration
  50. The 'mode' option has not been set, webpack will fallback to 'production' for th
  51. is value. Set 'mode' option to 'development' or 'production' to enable defaults
  52. for each environment.
  53. You can also set it to 'none' to disable any default behavior. Learn more: https
  54. ://webpack.js.org/concepts/mode/
  55. C:\Users\Administrator\cma>

2、错误原因

  1. 没有设置webpack的模式,是生产还是开发(production or development

3、解决办法

  1. 执行命令:webpack --mode=production或者webpack --mode=development
  2. C:\Users\Administrator>webpack --mode=production
  3. Hash: 68029a5423f50b49c81f
  4. Version: webpack 4.10.2
  5. Time: 91ms
  6. Built at: 2018-06-01 21:18:40
  7. ERROR in Entry module not found: Error: Can't resolve './src' in 'C:\Users\Admin
  8. istrator'
  9. C:\Users\Administrator>

发表评论

表情:
评论列表 (有 0 条评论,243人围观)

还没有评论,来说两句吧...

相关阅读