Skip to content

Commit c799fb2

Browse files
committed
chore: add vue-cli example
linked #2
1 parent e0ed0d8 commit c799fb2

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

examples/vue-cli/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "vue-cli",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build"
8+
},
9+
"dependencies": {
10+
"vue": "^3.3.4"
11+
},
12+
"devDependencies": {
13+
"@vue/cli-service": "~5.0.8",
14+
"unplugin-preprocessor-directives": "workspace:*"
15+
}
16+
}

examples/vue-cli/public/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<title>
8+
<%= htmlWebpackPlugin.options.title %>
9+
</title>
10+
<!-- #if (NODE_ENV !== 'production') -->
11+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
12+
<!-- #endif -->
13+
</head>
14+
15+
<body>
16+
<noscript>
17+
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
18+
Please enable it to continue.</strong>
19+
</noscript>
20+
<div id="app"></div>
21+
<!-- built files will be auto injected -->
22+
</body>
23+
24+
</html>

examples/vue-cli/src/App.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<script>
2+
export default {
3+
name: 'App',
4+
}
5+
</script>
6+
7+
<template>
8+
<!-- #if NODE_ENV !== 'development' -->
9+
<div>if</div>
10+
<!-- #else -->
11+
<div>else</div>
12+
<!-- #endif -->
13+
</template>

examples/vue-cli/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(App).mount('#app')

examples/vue-cli/vue.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @type {import('@vue/cli-service').ProjectOptions}
3+
*/
4+
5+
module.exports = {
6+
configureWebpack: {
7+
plugins: [
8+
require('unplugin-preprocessor-directives/webpack')(),
9+
],
10+
},
11+
chainWebpack: (config) => {
12+
config.module
13+
.rule('html')
14+
.test(/\.html$/)
15+
.use('html-webpack-plugin/loader')
16+
.loader(require.resolve('html-webpack-plugin/lib/loader.js'))
17+
.options({
18+
force: true,
19+
})
20+
.end()
21+
},
22+
}

0 commit comments

Comments
 (0)