A collection of WebF examples and demos.
openwebf / samples Goto Github PK
View Code? Open in Web Editor NEWA collection of WebF examples and demos.
License: MIT License
A collection of WebF examples and demos.
License: MIT License
本地在尝试使用Vue3 Vite+TypeScript时编译出来的js单文件页面空白 样式也无法加载 请求增加新的初始化项目例子。
根据官方Vue3文档
npm create vue@3
修改挂载点
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import './assets/main.css'
const app = createApp(App)
app.use(createPinia())
app.use(router)
app.mount(document.body)
将项目打包为一个文件:
import { fileURLToPath, URL } from 'node:url'
import { defineConfig, loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js'
import legacy from '@vitejs/plugin-legacy'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => ({
base: loadEnv(mode, process.cwd()).VITE_APP_NAME,
plugins: [
vue(),
cssInjectedByJsPlugin() //css注入进js中
// legacy({
// targets: ['defaults', 'not IE 11']
// })
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
build: {
minify: true,
rollupOptions: {
input: 'src/main.ts',
output: {
format: 'iife', //设置为单个js打包
dir: '/Users/qiuchenly/Downloads/hello_flutter/js',
entryFileNames: 'main.js' //重新设置入口文件
}
}
}
}))
npm run dev 在本地5174端口
新建了一个空的Flutter项目引入webf,然后简单初始化一下:
所以只好直接编译出产物去在App中加载:
"scripts": {
"dev": "vite",
"build": "run-p type-check build-only",
"preview": "vite preview",
"build-only": "vite build --mode=development --watch",
"type-check": "vue-tsc --noEmit",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"format": "prettier --write src/"
}
目前好看起来似乎加载完成 但是无法使用HMR实时加载 并且也有部分html标记无法解析
请求增加相关Simple项目供参考,谢谢。
如果支持TS,项目中是否会有d.ts文件做函数提示库呢?
Flutter端就是正常的新建项目设置依赖,没有其他修改。
关于CSS中的动画Transition是否无法使用?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.