56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { defineConfig } from '@tarojs/cli';
|
|
import path from 'path';
|
|
|
|
export default defineConfig(async (merge) => {
|
|
const baseConfig = {
|
|
projectName: 'hms-miniprogram',
|
|
date: '2026-4-23',
|
|
designWidth: 750,
|
|
deviceRatio: { 640: 2.34 / 2, 750: 1, 375: 2, 828: 1.81 / 2 },
|
|
sourceRoot: 'src',
|
|
outputRoot: 'dist',
|
|
plugins: [],
|
|
defineConstants: {},
|
|
copy: { patterns: [], options: {} },
|
|
framework: 'react',
|
|
compiler: 'webpack5',
|
|
alias: {
|
|
'@': path.resolve(__dirname, '..', 'src'),
|
|
},
|
|
sass: {
|
|
resource: ['src/styles/variables.scss'],
|
|
},
|
|
mini: {
|
|
compile: {
|
|
exclude: [],
|
|
},
|
|
postcss: {
|
|
pxtransform: { enable: true, config: {} },
|
|
cssModules: {
|
|
enable: false,
|
|
config: { namingPattern: 'module', generateScopedName: '[name]__[local]___[hash:base64:5]' },
|
|
},
|
|
},
|
|
},
|
|
h5: {
|
|
publicPath: '/',
|
|
staticDirectory: 'static',
|
|
postcss: {
|
|
autoprefixer: { enable: true, config: {} },
|
|
cssModules: {
|
|
enable: false,
|
|
config: { namingPattern: 'module', generateScopedName: '[name]__[local]___[hash:base64:5]' },
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
const devConfig = (await import('./dev')).default;
|
|
const prodConfig = (await import('./prod')).default;
|
|
|
|
if (process.env.NODE_ENV === 'production') {
|
|
return merge({}, baseConfig, prodConfig);
|
|
}
|
|
return merge({}, baseConfig, devConfig);
|
|
});
|