fix:修改WebAssembly编译方法

This commit is contained in:
18317449825
2023-08-25 21:38:41 +08:00
parent aba37584d9
commit 6f9252e800
2 changed files with 11 additions and 16 deletions

View File

@@ -344,13 +344,13 @@ if (arg === 'html') {
minimizer: [
new CssMinimizerPlugin(), // 去重压缩css
new TerserPlugin({ // 压缩JS代码
// terserOptions: {
// compress: {
// warnings: false,
// drop_console: true, // 去除console
// pure_funcs: ['console.log']
// }
// },
terserOptions: {
compress: {
warnings: false,
drop_console: true, // 去除console
pure_funcs: ['console.log']
}
},
exclude: /manifest.+js/,
sourceMap: config.build.productionSourceMap
})

View File

@@ -3644,18 +3644,14 @@ export default {
try {
// eslint-disable-next-line no-undef
const go = new Go()
console.log(WebAssembly.instantiateStreaming, 'log11')
const result = await WebAssembly.instantiateStreaming(fetch('/static/wasm/promqlparser.wasm', {
headers: {
'content-type': 'application/wasm'
}
}), go.importObject)
const response = await fetch('/static/wasm/promqlparser.wasm')
const buffer = await response.arrayBuffer()
const result = await WebAssembly.instantiate(buffer, go.importObject)
go.run(result.instance)
// eslint-disable-next-line no-undef
console.log(parsePromQL, 'log')
this.parsePromQL = parsePromQL
} catch (error) {
console.error(error, 'log')
console.error(error)
}
},
parsePromQL () {},
@@ -4129,7 +4125,6 @@ export default {
this.expressions.forEach((item, index) => {
if (item != '' && this.promqlKeys[index].state) {
const res = this.parsePromQL(item)
console.log(res, 'log')
if (res.status === 'error') {
error = true
this.$refs['promql-' + index][0].setError(res.message)