You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
1.5 KiB
78 lines
1.5 KiB
6 months ago
|
const path = require('path');
|
||
|
var prod = process.env.NODE_ENV === 'production';
|
||
|
|
||
|
module.exports = {
|
||
|
wpyExt: '.wpy',
|
||
|
eslint: true,
|
||
|
cliLogs: !prod,
|
||
|
build: {
|
||
|
web: {
|
||
|
htmlTemplate: path.join('src', 'index.template.html'),
|
||
|
htmlOutput: path.join('web', 'index.html'),
|
||
|
jsOutput: path.join('web', 'index.js')
|
||
|
}
|
||
|
},
|
||
|
resolve: {
|
||
|
alias: {
|
||
|
counter: path.join(__dirname, 'src/components/counter'),
|
||
|
'@': path.join(__dirname, 'src')
|
||
|
},
|
||
|
aliasFields: ['wepy', 'weapp'],
|
||
|
modules: ['node_modules']
|
||
|
},
|
||
|
compilers: {
|
||
|
less: {
|
||
|
compress: prod
|
||
|
},
|
||
|
/* sass: {
|
||
|
outputStyle: 'compressed'
|
||
|
}, */
|
||
|
babel: {
|
||
|
sourceMap: true,
|
||
|
presets: [
|
||
|
'env'
|
||
|
],
|
||
|
plugins: [
|
||
|
'transform-class-properties',
|
||
|
'transform-decorators-legacy',
|
||
|
'transform-object-rest-spread',
|
||
|
'transform-export-extensions',
|
||
|
['global-define', {
|
||
|
__API_HOST__: prod ? 'https://app.diabetes.com.cn' : 'https://apptest.diabetes.com.cn',
|
||
|
__PRO__: prod
|
||
|
}]
|
||
|
]
|
||
|
}
|
||
|
},
|
||
|
plugins: {
|
||
|
},
|
||
|
appConfig: {
|
||
|
noPromiseAPI: ['createSelectorQuery']
|
||
|
}
|
||
|
};
|
||
|
|
||
|
if (prod) {
|
||
|
// 压缩sass
|
||
|
// module.exports.compilers['sass'] = {outputStyle: 'compressed'}
|
||
|
|
||
|
// 压缩js
|
||
|
module.exports.plugins = {
|
||
|
uglifyjs: {
|
||
|
filter: /\.js$/,
|
||
|
config: {
|
||
|
}
|
||
|
},
|
||
|
imagemin: {
|
||
|
filter: /\.(jpg|png|jpeg)$/,
|
||
|
config: {
|
||
|
jpg: {
|
||
|
quality: 80
|
||
|
},
|
||
|
png: {
|
||
|
quality: 80
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|