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', "syntax-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 } } } }