mirror of
https://github.com/SunnyQjm/taro-cropper.git
synced 2026-10-05 01:15:49 +08:00
93 lines
2.0 KiB
JavaScript
93 lines
2.0 KiB
JavaScript
const config = {
|
|
projectName: 'taro-cropper',
|
|
date: '2019-8-15',
|
|
designWidth: 750,
|
|
deviceRatio: {
|
|
'640': 2.34 / 2,
|
|
'750': 1,
|
|
'828': 1.81 / 2
|
|
},
|
|
sourceRoot: 'src',
|
|
outputRoot: 'dist',
|
|
babel: {
|
|
sourceMap: true,
|
|
presets: [
|
|
['env', {
|
|
modules: false
|
|
}]
|
|
],
|
|
plugins: [
|
|
'transform-decorators-legacy',
|
|
'transform-class-properties',
|
|
'transform-object-rest-spread'
|
|
]
|
|
},
|
|
mini: {
|
|
webpackChain (chain, webpack) {},
|
|
cssLoaderOption: {},
|
|
postcss: {
|
|
pxtransform: {
|
|
enable: true,
|
|
config: {}
|
|
},
|
|
url: {
|
|
enable: true,
|
|
config: {
|
|
limit: 10240 // 设定转换尺寸上限
|
|
}
|
|
}
|
|
}
|
|
},
|
|
h5: {
|
|
publicPath: '/',
|
|
staticDirectory: 'static',
|
|
webpackChain (chain, webpack) {},
|
|
postcss: {
|
|
autoprefixer: {
|
|
enable: true,
|
|
config: {
|
|
browsers: [
|
|
'last 3 versions',
|
|
'Android >= 4.1',
|
|
'ios >= 8'
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
if (process.env.TARO_BUILD_TYPE === 'ui') {
|
|
Object.assign(config.h5, {
|
|
enableSourceMap: false,
|
|
enableExtract: false,
|
|
enableDll: false
|
|
});
|
|
config.h5.webpackChain = chain => {
|
|
chain.plugins.delete('htmlWebpackPlugin');
|
|
chain.plugins.delete('addAssetHtmlWebpackPlugin');
|
|
chain.merge({
|
|
output: {
|
|
path: path.join(process.cwd(), 'dist', 'h5'),
|
|
filename: 'index.js',
|
|
libraryTarget: 'umd',
|
|
library: 'taro-ui-sample'
|
|
},
|
|
externals: {
|
|
nervjs: 'commonjs2 nervjs',
|
|
classnames: 'commonjs2 classnames',
|
|
'@tarojs/components': 'commonjs2 @tarojs/components',
|
|
'@tarojs/taro-h5': 'commonjs2 @tarojs/taro-h5',
|
|
'weui': 'commonjs2 weui'
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
module.exports = function (merge) {
|
|
if (process.env.NODE_ENV === 'development') {
|
|
return merge({}, config, require('./dev'))
|
|
}
|
|
return merge({}, config, require('./prod'))
|
|
};
|