Files
esbuild-wasm-compiler/example/demo1/index2.html
T

55 lines
1.1 KiB
HTML

<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>esbuild-wasm-demo</title>
<!--<script src="https://cdn.jsdelivr.net/npm/@rainetian/esbuild-wasm-compiler/dist/esbuild-wasm-compiler.min.js"></script>-->
<script src="../../dist/esbuild-wasm-compiler.min.js"></script>
</head>
<body>
<div id="app">loading...</div>
<script>
let Main = `import { createApp } from 'vue'
import App from './App.vue'
createApp(App).mount('#app')
`
let AppCode = `<script setup>
import { ref } from 'vue'
const msg = ref('我是vue!')
<\/script>
<template>
<h1>{{ msg }}</h1>
<input v-model="msg" />
</template>
<style scoped>
h1 {
color: red;
}
</style>
`
const files = {
'/main.js': Main,
'/App.vue': AppCode,
}
</script>
<script>
const compiler = new Compiler({
getFileContent: (path) => {
return Compiler.getFileContent(path, files)
},
},{
esmServiceUrl:'https://pdn.zijieapi.com/esm/bv'
})
compiler.createApp('/main.js').mount('#app')
</script>
</body>
</html>