Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support new component hot update for webpack #423

Merged
merged 8 commits into from Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/vue-cli-vue3/babel.config.js
@@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset',
],
}
19 changes: 19 additions & 0 deletions examples/vue-cli-vue3/jsconfig.json
@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
26 changes: 26 additions & 0 deletions examples/vue-cli-vue3/package.json
@@ -0,0 +1,26 @@
{
"name": "example-vue-cli-vue3",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.8.3",
"vue": "^3.2.13"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"unplugin-vue-components": "workspace:*"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}
16 changes: 16 additions & 0 deletions examples/vue-cli-vue3/public/index.html
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
22 changes: 22 additions & 0 deletions examples/vue-cli-vue3/src/App.vue
@@ -0,0 +1,22 @@
<script>
export default {
name: 'App',
}
</script>

<template>
<HelloWorld1 msg="one" />
<HelloWorld2 msg="two" />
<HelloWorld3 msg="three" />
</template>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
14 changes: 14 additions & 0 deletions examples/vue-cli-vue3/src/components/HelloWorld1.vue
@@ -0,0 +1,14 @@
<script>
export default {
name: 'HelloWorld1',
props: {
msg: String,
},
}
</script>

<template>
<div>
<h1>Hello World 1 {{ msg }}</h1>
</div>
</template>
14 changes: 14 additions & 0 deletions examples/vue-cli-vue3/src/components/HelloWorld2.vue
@@ -0,0 +1,14 @@
<script>
export default {
name: 'HelloWorld2',
props: {
msg: String,
},
}
</script>

<template>
<div>
<h1>Hello World 2 {{ msg }}</h1>
</div>
</template>
14 changes: 14 additions & 0 deletions examples/vue-cli-vue3/src/components/HelloWorld3.vue
@@ -0,0 +1,14 @@
<script>
export default {
name: 'HelloWorld3',
props: {
msg: String,
},
}
</script>

<template>
<div>
<h1>Hello World 3 {{ msg }}</h1>
</div>
</template>
4 changes: 4 additions & 0 deletions examples/vue-cli-vue3/src/main.js
@@ -0,0 +1,4 @@
import { createApp } from 'vue'
import App from './App.vue'

createApp(App).mount('#app')
15 changes: 15 additions & 0 deletions examples/vue-cli-vue3/vue.config.js
@@ -0,0 +1,15 @@
const { defineConfig } = require('@vue/cli-service')
const Components = require('unplugin-vue-components/webpack')

module.exports = defineConfig({
transpileDependencies: true,
configureWebpack: {
plugins: [
Components({
dirs: [
'./src/components',
],
}),
],
},
})