提交 e16b48d9 编写于 作者: fxy060608's avatar fxy060608

fix(mp-alipay): disable compress

上级 ecf72e33
......@@ -7647,9 +7647,7 @@ var serviceContext = (function (vue) {
}, reject);
});
}
const chooseImage = defineAsyncApi(API_CHOOSE_IMAGE,
// @ts-expect-error crop 属性App特有
({ count, sizeType, sourceType, crop } = {}, { resolve, reject }) => {
const chooseImage = defineAsyncApi(API_CHOOSE_IMAGE, ({ count, sizeType, sourceType, crop } = {}, { resolve, reject }) => {
initI18nChooseImageMsgsOnce();
const { t } = useI18n();
const errorCallback = warpPlusErrorCallback(reject);
......
......@@ -39,7 +39,10 @@ export function uniViteCopyPlugin({
},
(watcher) => {
if (process.env.NODE_ENV !== 'development') {
watcher.close().then(() => resolve(void 0))
// 生产模式下,延迟 close,否则会影响 chokidar 初始化的 add 等事件
setTimeout(() => {
watcher.close().then(() => resolve(void 0))
}, 1000)
} else {
resolve(void 0)
}
......
......@@ -231,6 +231,10 @@ const uniMiniProgramAlipayPlugin = {
},
build: {
assetsInlineLimit: 0,
terserOptions: {
compress: false,
mangle: false,
},
},
};
},
......
......@@ -12,6 +12,10 @@ const uniMiniProgramAlipayPlugin: Plugin = {
},
build: {
assetsInlineLimit: 0,
terserOptions: {
compress: false,
mangle: false,
},
},
}
},
......
......@@ -34,13 +34,11 @@ export function buildOptions(): UserConfig['build'] {
// sourcemap: 'inline', // TODO
// target: ['chrome53'], // 由小程序自己启用 es6 编译
emptyOutDir: false, // 不清空输出目录,否则会影响自定义的一些文件输出,比如wxml
lib: {
entry: resolveMainPathOnce(inputDir),
formats: ['cjs'],
},
rollupOptions: {
input: resolveMainPathOnce(inputDir),
output: {
entryFileNames: 'app.js',
format: 'cjs',
manualChunks: createMoveToVendorChunkFn(),
chunkFileNames: createChunkFileNames(inputDir),
assetFileNames: '[name][extname]',
......
......@@ -101,11 +101,6 @@ export function initEnv(type: 'dev' | 'build', options: CliOptions) {
initAutomator(options)
if (process.env.NODE_ENV === 'production') {
if (!(options as BuildOptions).minify) {
;(options as BuildOptions).minify = 'terser'
}
}
if (process.env.UNI_PLATFORM === 'app') {
const pkg = require('../../package.json')
console.log(
......
......@@ -4,9 +4,11 @@ import {
resolveComponentsLibPath,
} from '@dcloudio/uni-cli-shared'
import { VitePluginUniResolvedOptions } from '..'
import { hasOwn } from '@vue/shared'
export function createBuild(
options: VitePluginUniResolvedOptions
options: VitePluginUniResolvedOptions,
config: UserConfig
): UserConfig['build'] {
initEasycomsOnce(options.inputDir, {
dirs: [resolveComponentsLibPath()],
......@@ -14,5 +16,11 @@ export function createBuild(
})
return {
chunkSizeWarningLimit: 100000000,
minify:
config.build && hasOwn(config.build, 'minify')
? config.build.minify
: process.env.NODE_ENV === 'production'
? 'terser'
: false,
}
}
......@@ -40,7 +40,7 @@ export function createConfig(
logLevel: config.logLevel || 'warn',
optimizeDeps: createOptimizeDeps(options),
server: createServer(options),
build: createBuild(options),
build: createBuild(options, config),
css: createCss(options),
}
}
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册