123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- const path = require('path')
- const prod = process.env.NODE_ENV === 'production'
- module.exports = {
- wpyExt: '.wpy',
- build: {
- web: {
- htmlTemplate: path.join('src', 'index.template.html'),
- htmlOutput: path.join('web', 'index.html'),
- jsOutput: path.join('web', 'index.js')
- }
- },
- resolve: {
- alias: {
- 'ald': path.join(__dirname, 'src/utils/ald-stat'),
- 'lib': path.join(__dirname, 'src/lib/lib'),
- 'md5': path.join(__dirname, 'src/lib/md5'),
- '@': path.join(__dirname, 'src')
- },
- modules: ['node_modules']
- },
- // eslint: true,
- compilers: {
- // less: {
- // compress: true
- // },
- sass: {
- outputStyle: 'compressed'
- },
- babel: {
- sourceMap: false,
- presets: [
- 'env'
- ],
- plugins: [
- 'transform-class-properties',
- 'transform-decorators-legacy',
- 'transform-object-rest-spread',
- 'transform-export-extensions'
- ]
- }
- },
- plugins: {
- imgbase64: {
- css: false,
- html: true,
- output: 'dist',
- // fileType: 'scss',
- path: '/src/img'
- },
- replace: {
- filter: /lib\.js$/,
- config: {
- find: /__ENV__/g,
- replace: process.env.NODE_ENV
- }
- }
- },
- appConfig: {
- noPromiseAPI: ['createSelectorQuery']
- }
- }
- if (prod) {
- delete module.exports.compilers.babel.sourcesMap
- // 压缩sass
- module.exports.compilers['sass'] = {
- outputStyle: 'compressed'
- }
- // 压缩less
- // module.exports.compilers['less'] = {
- // compress: true
- // }
- // 压缩js
- module.exports.plugins = {
- uglifyjs: {
- filter: /\.js$/,
- config: {}
- },
- imagemin: {
- filter: /\.(jpg|png|jpeg)$/,
- config: {
- jpg: {
- quality: 80
- },
- png: {
- quality: 80
- }
- }
- },
- imgbase64: {
- css: false,
- html: true,
- output: 'dist',
- // fileType: 'scss',
- path: '/src/img'
- },
- replace: {
- filter: /lib\.js$/,
- config: {
- find: /__ENV__/g,
- replace: process.env.NODE_ENV
- }
- }
- }
- }
|