index.js 2.0 KB

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