vue.config.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. const path = require('path')
  2. //const px2rem = require("postcss-px2rem");
  3. function resolve(dir) {
  4. return path.join(__dirname, dir)
  5. }
  6. // const postcss = px2rem({
  7. // // 基准大小 baseSize,需要和rem.js中相同
  8. // remUnit: 14,
  9. // });
  10. process.env.VUE_APP_VERSION = require('./package.json').version;
  11. process.env.VUE_APP_BUILD_TIME = new Date().getTime();
  12. module.exports = {
  13. outputDir: 'dist/publish-dir',
  14. publicPath: './',
  15. filenameHashing: true,
  16. productionSourceMap: false,
  17. chainWebpack(config) {
  18. // set svg-sprite-loader
  19. config.module
  20. .rule('svg')
  21. .exclude.add(resolve('src/icons'))
  22. .end()
  23. config.module
  24. .rule('icons')
  25. .test(/\.svg$/)
  26. .include.add(resolve('src/icons'))
  27. .end()
  28. .use('svg-sprite-loader')
  29. .loader('svg-sprite-loader')
  30. .options({
  31. symbolId: 'icon-[name]'
  32. })
  33. .end()
  34. },
  35. css: {
  36. loaderOptions: {
  37. // postcss: {
  38. // plugins: [postcss],
  39. // },
  40. sass: {
  41. sassOptions: {
  42. outputStyle: 'expanded'
  43. }
  44. }
  45. },
  46. },
  47. };