123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import { defineConfig } from "@tarojs/cli";
-
- const path = require("path");
-
- import devConfig from "./dev";
- import prodConfig from "./prod";
- const url = "http://localhost:9087";
- const url2 = "https://apis.map.qq.com";
-
- export default defineConfig(async (merge, { command, mode }) => {
- const config = {
- projectName: "civilized-miniapp",
- date: "2024-03-21",
- designWidth(input) {
- console.log("---->", input?.file);
-
-
-
- return 750;
- },
- deviceRatio: {
- 640: 2.34 / 2,
- 750: 1,
- 828: 1.81 / 2,
- 375: 2 / 1,
- },
-
- sourceRoot: "src",
- outputRoot: "dist",
- plugins: [],
- defineConstants: {},
- copy: {
- patterns: [{ from: "src/assets/tabbar/", to: "dist/assets/tabbar/" }],
- options: {},
- },
- framework: "react",
- compiler: "webpack4",
- alias: {
- "@": path.resolve(__dirname, "..", "src"),
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- h5: {
- publicPath: "/",
- staticDirectory: "static",
- outputDir: "dist",
- router: {
- mode: "hash",
- },
- esnextModules: ["@antmjs"],
- postcss: {
- autoprefixer: {
- enable: true,
- config: {},
- },
-
- pxtransform: {
- enable: true,
- config: {
-
-
-
-
-
-
-
-
-
-
-
-
- },
- },
- cssModules: {
- enable: true,
- config: {
- namingPattern: "module",
- generateScopedName: "[name]__[local]___[hash:base64:5]",
- },
- },
- },
- devServer: {
- proxy: {
- "/api2": {
- target: url2,
- changeOrigin: true,
- pathRewrite: {
- "^/api2": "",
- },
- },
- "/api": {
- target: url,
- changeOrigin: true,
- },
-
- },
- },
- },
- };
- if (process.env.NODE_ENV === "development") {
- return merge({}, config, devConfig);
- }
- return merge({}, config, prodConfig);
- });
|