UNPKG

@aniyajs/rotor

Version:

基于webpack5开发的一款专注于打包、运行的工具

59 lines (54 loc) 1.8 kB
const fs = require("fs-extra"); function defaultConfig(appConfigTempIndexJs) { if (appConfigTempIndexJs && fs.existsSync(appConfigTempIndexJs)) { const isEnvDevelopment = process.env.NODE_ENV === "development"; const isEnvProduction = process.env.NODE_ENV === "production"; delete require.cache[require.resolve(appConfigTempIndexJs)]; const latestCustomConfigContent = require(appConfigTempIndexJs).default; // 默认配置 return { // 静态资源文件路径前缀 // 只在生产环境生效 publicPath: "/", // 打包文件出口 outputPath: "build", // 开发环境默认开启 `cheap-module-source-map` // 生产环境默认 false // 请注意,生产环境中这个配置有暴露源码风险 devtool: isEnvDevelopment ? "cheap-module-source-map" : isEnvProduction && false, // 标题 title: "ANIYA", // 图片限制大小 // 单位kb,文件小于设定值时模块会作为一个Base64编码的字符串注入到包中 imageSizeLimit: 1024, // 是否使用 tailwind css useTailwindcss: false, // 代理 proxy: {}, // 是否开启热刷新 fastRefresh: true, // 自定义全局变量 define: {}, // 自动打开 open: true, // 是否关闭eslint检测 disableESLintPlugin: false, // 插件配置 aniyaPlugins: [], ...latestCustomConfigContent, // 开发服务器 devServer: { port: 8000, host: "0.0.0.0", https: false, ssl_srt_file: "ssl/server.crt", ssl_key_file: "ssl/server.key", ...latestCustomConfigContent.devServer, }, /* *****待优化***** */ }; } } module.exports = defaultConfig;