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

fix(nvue): move polyfill to banner

上级 2181c17d
......@@ -8,6 +8,7 @@ import debug from 'debug'
import {
APP_CONFIG_SERVICE,
hash,
polyfillCode,
removeExt,
transformWithEsbuild,
} from '@dcloudio/uni-cli-shared'
......@@ -40,7 +41,8 @@ export function uniEsbuildPlugin({
target: 'es6',
minify: config.build.minify ? true : false,
banner: {
js: `"use weex:vue";`,
js: `"use weex:vue";
${polyfillCode}`,
},
bundle: true,
write: false,
......@@ -148,9 +150,6 @@ if(webview){
const __pagePath = '${removeExt(filename)}'
let __pageQuery = {}
try{ __pageQuery = JSON.parse(webview.__query__) }catch(e){}
if(uni.base64ToArrayBuffer){
ArrayBuffer = uni.base64ToArrayBuffer('').constructor
}
App.mpType = 'page'
const app = Vue.createPageApp(App,{$store:getApp({allowDefault:true}).$store,__pageId,__pagePath,__pageQuery})
app.provide('__globalStyles', Vue.useCssStyles([...__uniConfig.styles, ...(App.styles||[])]))
......
export * from './pages'
export * from './manifest'
export { polyfillCode } from './pages/code'
export { polyfillCode, arrayBufferCode, restoreGlobalCode } from './pages/code'
export const arrayBufferCode = `
if(typeof uni !== 'undefined' && uni.base64ToArrayBuffer){
ArrayBuffer = uni.base64ToArrayBuffer('').constructor
};
`
export const polyfillCode = `
if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
Promise.prototype.finally = function(callback) {
......@@ -9,10 +14,8 @@ if (typeof Promise !== 'undefined' && !Promise.prototype.finally) {
})
)
}
}
if(uni&&uni.base64ToArrayBuffer){
ArrayBuffer = uni.base64ToArrayBuffer('').constructor
}
};
${arrayBufferCode}
`
export const restoreGlobalCode = `
if(uni.restoreGlobal){
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册