vue.config.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const webpack = require('webpack')
  2. const { defineConfig } = require('@vue/cli-service')
  3. process.env.VUE_APP_VERSION = require('./package.json').version
  4. const dayjs = require('dayjs')
  5. const time = dayjs().format('YYYY-M-D HH:mm:ss')
  6. process.env.VUE_APP_UPDATE_TIME = time
  7. module.exports = defineConfig({
  8. chainWebpack: (config) => {
  9. config.plugin('define').tap((definitions) => {
  10. Object.assign(definitions[0], {
  11. __VUE_OPTIONS_API__: 'true',
  12. __VUE_PROD_DEVTOOLS__: 'false',
  13. __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: 'false'
  14. })
  15. return definitions
  16. })
  17. },
  18. pages: {
  19. mobile: {
  20. template: 'mobile/index.html',
  21. entry: 'mobile/main.js',
  22. filename: 'mobile.html'
  23. },
  24. index: {
  25. template: 'public/index.html',
  26. entry: 'src/main.js',
  27. filename: 'index.html'
  28. }
  29. },
  30. publicPath: process.env.PUBLIC_PATH,
  31. productionSourceMap: process.env.VUE_APP_CLI_MODE === 'prod' ? false : true,
  32. // transpileDependencies: true, // 默认false,表示babel-loader 会忽略所有 node_modules 中的文件
  33. configureWebpack: {
  34. module: {
  35. rules: [
  36. // {
  37. // test: /\.cur$/,
  38. // use: {
  39. // loader: 'file-loader'
  40. // }
  41. // }
  42. ]
  43. },
  44. plugins: [
  45. new webpack.ProvidePlugin({
  46. utils: ['/src/utils.js', 'default'],
  47. config: ['/src/config.js', 'default'],
  48. useSizeAdapt: ['/src/useFunctions/useSizeAdapt.js', 'default'],
  49. }),
  50. ],
  51. },
  52. })