Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit e5b94a4

Browse files
committed
chore: init
0 parents  commit e5b94a4

File tree

10 files changed

+4978
-0
lines changed

10 files changed

+4978
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
.DS_Store
3+
node_modules

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# vue-next-webpack-preview
2+
3+
Minimal webpack setup for Vue 3 (alpha). This is for preview purposes only. There might be bugs and undocumented behavior differences from v2, which are expected.
4+
5+
Also note that if you are using VSCode, Vetur isn't updated to take advantage of Vue 3's typing yet so intellisense in Vue files may not be fully functional (especially in templates).

index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<link rel="stylesheet" href="/dist/main.css">
2+
<div id="app"></div>
3+
<script src="/dist/main.js"></script>

package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"dev": "webpack-dev-server",
5+
"build": "webpack --env.prod",
6+
"postinstall": "patch-package"
7+
},
8+
"dependencies": {
9+
"@vueuse/core": "^3.0.0-alpha.19",
10+
"vue": "next"
11+
},
12+
"devDependencies": {
13+
"@vue/compiler-sfc": "^3.0.0-alpha.0",
14+
"css-loader": "^3.4.0",
15+
"file-loader": "^5.0.2",
16+
"mini-css-extract-plugin": "^0.9.0",
17+
"patch-package": "^6.2.0",
18+
"postinstall-postinstall": "^2.0.0",
19+
"url-loader": "^3.0.0",
20+
"vue-loader": "next",
21+
"webpack": "^4.41.4",
22+
"webpack-cli": "^3.3.10",
23+
"webpack-dev-server": "^3.10.1"
24+
}
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js b/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
2+
index a44850d..17f56fb 100644
3+
--- a/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
4+
+++ b/node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js
5+
@@ -1672,7 +1672,15 @@ if ( (process.env.NODE_ENV !== 'production')) {
6+
}
7+
const map = new Map();
8+
function registerHMR(instance) {
9+
- map.get(instance.type.__hmrId).instances.add(instance);
10+
+ let record = map.get(instance.type.__hmrId)
11+
+ if (!record) {
12+
+ record = {
13+
+ comp: instance.type,
14+
+ instances: new Set(),
15+
+ }
16+
+ map.set(instance.type.__hmrId, record)
17+
+ }
18+
+ record.instances.add(instance);
19+
}
20+
function unregisterHMR(instance) {
21+
map.get(instance.type.__hmrId).instances.delete(instance);

src/App.vue

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<template>
2+
<div id="app">
3+
<img src="./logo.svg" />
4+
<h1>Hello <a href='https://github.com/vuejs/vue-next' target='__blank'>Vue 3</a> and <a href='https://github.com/antfu/vueuse' target='__blank'>VueUse</a>!</h1>
5+
6+
<h2>{{new Date(now)}}</h2>
7+
</div>
8+
</template>
9+
10+
<script>
11+
import { ref } from 'vue'
12+
import { useNow } from '@vueuse/core'
13+
14+
export default {
15+
setup() {
16+
const now = useNow()
17+
18+
return {
19+
now
20+
}
21+
}
22+
}
23+
</script>
24+
25+
<style scoped>
26+
@import url('https://fonts.googleapis.com/css?family=Noto+Serif&display=swap');
27+
28+
html, body, h1, h2, h3, p {
29+
font-family: 'Noto Serif', serif;
30+
}
31+
32+
#app {
33+
text-align: center;
34+
color: rgba(0,0,0,0.4);
35+
}
36+
img {
37+
width: 500px;
38+
}
39+
a {
40+
color: #41b883;
41+
text-decoration: none;
42+
}
43+
</style>

src/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

src/main.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
4+
createApp().mount(App, '#app')

webpack.config.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
const path = require('path')
2+
const { VueLoaderPlugin } = require('vue-loader')
3+
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
4+
5+
module.exports = (env = {}) => ({
6+
mode: env.prod ? 'production' : 'development',
7+
devtool: env.prod ? 'source-map' : 'cheap-module-eval-source-map',
8+
entry: path.resolve(__dirname, './src/main.js'),
9+
output: {
10+
path: path.resolve(__dirname, './dist'),
11+
publicPath: '/dist/'
12+
},
13+
module: {
14+
rules: [
15+
{
16+
test: /\.vue$/,
17+
use: 'vue-loader'
18+
},
19+
{
20+
test: /\.svg$/,
21+
use: {
22+
loader: 'url-loader',
23+
options: { limit: 8192 }
24+
}
25+
},
26+
{
27+
test: /\.css$/,
28+
use: [
29+
{
30+
loader: MiniCssExtractPlugin.loader,
31+
options: { hmr: !env.prod }
32+
},
33+
'css-loader'
34+
]
35+
}
36+
]
37+
},
38+
plugins: [
39+
new VueLoaderPlugin(),
40+
new MiniCssExtractPlugin({
41+
filename: '[name].css'
42+
})
43+
],
44+
devServer: {
45+
inline: true,
46+
hot: true,
47+
stats: 'minimal',
48+
contentBase: __dirname,
49+
overlay: true
50+
}
51+
})

0 commit comments

Comments
 (0)