index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // see http://vuejs-templates.github.io/webpack for documentation.
  2. var path = require('path')
  3. var fileExtConfig = {
  4. swan: {
  5. template: 'swan',
  6. script: 'js',
  7. style: 'css',
  8. platform: 'swan'
  9. },
  10. wx: {
  11. template: 'wxml',
  12. script: 'js',
  13. style: 'wxss',
  14. platform: 'wx'
  15. }
  16. }
  17. var fileExt = fileExtConfig[process.env.PLATFORM]
  18. module.exports = {
  19. build: {
  20. env: require('./prod.env'),
  21. index: path.resolve(__dirname, `../dist/index.html`),
  22. assetsRoot: path.resolve(__dirname, `../dist`),
  23. assetsSubDirectory: '',
  24. assetsPublicPath: '/',
  25. productionSourceMap: false,
  26. // Gzip off by default as many popular static hosts such as
  27. // Surge or Netlify already gzip all static assets for you.
  28. // Before setting to `true`, make sure to:
  29. // npm install --save-dev compression-webpack-plugin
  30. productionGzip: false,
  31. productionGzipExtensions: ['js', 'css'],
  32. // Run the build command with an extra argument to
  33. // View the bundle analyzer report after build finishes:
  34. // `npm run build --report`
  35. // Set to `true` or `false` to always turn it on or off
  36. bundleAnalyzerReport: process.env.npm_config_report,
  37. fileExt: fileExt
  38. },
  39. dev: {
  40. env: require('./dev.env'),
  41. port: 8080,
  42. // 在小程序开发者工具中不需要自动打开浏览器
  43. autoOpenBrowser: false,
  44. assetsSubDirectory: '',
  45. assetsPublicPath: '/',
  46. proxyTable: {},
  47. // CSS Sourcemaps off by default because relative paths are "buggy"
  48. // with this option, according to the CSS-Loader README
  49. // (https://github.com/webpack/css-loader#sourcemaps)
  50. // In our experience, they generally work as expected,
  51. // just be aware of this issue when enabling this option.
  52. cssSourceMap: false,
  53. fileExt: fileExt
  54. }
  55. }