提交 43cbf48c 编写于 作者: fxy060608's avatar fxy060608 提交者: qiang

fix(uts): 修复 升级 vite 后,uts 加密插件编译报错

上级 d2051444
import path, { basename, join, relative } from 'path'
import fs from 'fs-extra'
import { makeLegalIdentifier } from '@rollup/pluginutils'
import { APP_PLATFORM } from './manifest/utils'
import { normalizePath } from './shared'
......@@ -8,21 +9,15 @@ export function isEncrypt(pluginDir: string) {
}
function createRollupCommonjsCode(
pluginDir: string,
_pluginDir: string,
pluginRelativeDir: string
) {
const name = makeLegalIdentifier(pluginRelativeDir)
return `
import * as commonjsHelpers from "\0commonjsHelpers.js"
import { __module, exports as __exports } from "\0${normalizePath(
pluginDir
)}?commonjs-module"
Object.defineProperty(__exports, '__esModule', { value: true })
__module.exports = uni.requireUTSPlugin('${normalizePath(pluginRelativeDir)}')
export default /*@__PURE__*/commonjsHelpers.getDefaultExportFromCjs(__exports);
export { __exports as __moduleExports };
const ${name} = uni.requireUTSPlugin('${normalizePath(pluginRelativeDir)}')
export default /*@__PURE__*/commonjsHelpers.getDefaultExportFromCjs(${name});
export { ${name} as __moduleExports };
`
}
function createWebpackCommonjsCode(pluginRelativeDir: string) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册