wepy.config.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. const path = require('path');
  2. const PluginUglifyjs = require('@wepy/plugin-uglifyjs')
  3. const DefinePlugin = require('@wepy/plugin-define');
  4. let env = process.env.NODE_ENV.toString();
  5. var prod = env.split('-')[0] === 'prod';
  6. module.exports = {
  7. wpyExt: '.wpy',
  8. eslint: false,
  9. cliLogs: !prod,
  10. static: ['static'],
  11. build: {
  12. },
  13. resolve: {
  14. extensions: ['.js', '.wxs', '.wpy'],
  15. alias: {
  16. counter: path.join(__dirname, 'src/components/counter'),
  17. '@': path.join(__dirname, 'src'),
  18. // 根据在package.json中配置的不同编译命令,引用/config下不同的配置文件
  19. '@config': path.join(__dirname, 'src', 'config', 'index')
  20. },
  21. aliasFields: ['wepy', 'weapp'],
  22. modules: ['node_modules']
  23. },
  24. compilers: {
  25. less: {
  26. compress: true
  27. },
  28. babel: {
  29. sourceMap: true,
  30. presets: [
  31. '@babel/preset-env'
  32. ],
  33. plugins: [
  34. '@wepy/babel-plugin-import-regenerator'
  35. ]
  36. }
  37. },
  38. plugins: [
  39. PluginUglifyjs({
  40. compress: true
  41. }),
  42. DefinePlugin({
  43. NODE_ENV: JSON.stringify(env)
  44. })
  45. ],
  46. appConfig: {
  47. noPromiseAPI: ['createSelectorQuery']
  48. }
  49. }