File tree Expand file tree Collapse file tree 3 files changed +64
-22
lines changed Expand file tree Collapse file tree 3 files changed +64
-22
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default defineConfig({
31
31
})
32
32
```
33
33
34
- Example: [ ` examples/vite/ ` ] ( ./examples/vite/ )
34
+ Example: [ ` examples/vite ` ] ( ./examples/vite/ )
35
35
36
36
<br ></details >
37
37
@@ -40,10 +40,23 @@ Example: [`examples/vite/`](./examples/vite/)
40
40
41
41
``` ts
42
42
// webpack.config.js
43
+ const { VueLoaderPlugin } = require (' vue-loader' )
44
+ const Markdown = require (' unplugin-vue-markdown/webpack' )
45
+
43
46
module .exports = {
44
47
/* ... */
48
+ module: {
49
+ rules: [
50
+ // ... other rules
51
+ {
52
+ test: / \. (vue| md)$ / ,
53
+ loader: ' vue-loader'
54
+ }
55
+ ]
56
+ },
45
57
plugins: [
46
- require (' unplugin-vue-markdown/webpack' )({ /* options */ })
58
+ new VueLoaderPlugin (),
59
+ Markdown ({ /* options */ })
47
60
]
48
61
}
49
62
```
@@ -55,20 +68,28 @@ module.exports = {
55
68
56
69
``` ts
57
70
// vue.config.js
71
+ const Markdown = require (' unplugin-vue-markdown/webpack' )
72
+
58
73
module .exports = {
59
- configureWebpack: {
60
- plugins: [
61
- require (' unplugin-vue-markdown/webpack' )({ /* options */ }),
62
- ],
63
- },
74
+ parallel: false , // Disable thread-loader which will cause errors, we are still investigating the root cause
64
75
chainWebpack : (config ) => {
65
76
config .module
66
77
.rule (' vue' )
67
78
.test (/ \. (vue| md)$ / ) // <-- allows Vue to compile Markdown files
79
+
80
+ config
81
+ .plugin (' markdown' )
82
+ .use (Markdown ({
83
+ markdownItUses: [
84
+ prism ,
85
+ ],
86
+ }))
68
87
},
69
88
}
70
89
```
71
90
91
+ Example: [ ` examples/vue-cli ` ] ( ./examples/vue-cli/ )
92
+
72
93
<br ></details >
73
94
74
95
## Import Markdown as Vue components
@@ -160,7 +181,7 @@ npm i @unhead/vue
160
181
``` js
161
182
// vite.config.js
162
183
import Vue from ' @vitejs/plugin-vue'
163
- import Markdown from ' unplugin-vue-markdown'
184
+ import Markdown from ' unplugin-vue-markdown/vite '
164
185
165
186
export default {
166
187
plugins: [
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export default defineConfig({
31
31
})
32
32
```
33
33
34
- Example: [ ` examples/vite/ ` ] ( ./examples/vite/ )
34
+ Example: [ ` examples/vite ` ] ( ./examples/vite/ )
35
35
36
36
<br ></details >
37
37
@@ -40,10 +40,23 @@ Example: [`examples/vite/`](./examples/vite/)
40
40
41
41
``` ts
42
42
// webpack.config.js
43
+ const { VueLoaderPlugin } = require (' vue-loader' )
44
+ const Markdown = require (' unplugin-vue-markdown/webpack' )
45
+
43
46
module .exports = {
44
47
/* ... */
48
+ module: {
49
+ rules: [
50
+ // ... other rules
51
+ {
52
+ test: / \. (vue| md)$ / ,
53
+ loader: ' vue-loader'
54
+ }
55
+ ]
56
+ },
45
57
plugins: [
46
- require (' unplugin-vue-markdown/webpack' )({ /* options */ })
58
+ new VueLoaderPlugin (),
59
+ Markdown ({ /* options */ })
47
60
]
48
61
}
49
62
```
@@ -55,20 +68,28 @@ module.exports = {
55
68
56
69
``` ts
57
70
// vue.config.js
71
+ const Markdown = require (' unplugin-vue-markdown/webpack' )
72
+
58
73
module .exports = {
59
- configureWebpack: {
60
- plugins: [
61
- require (' unplugin-vue-markdown/webpack' )({ /* options */ }),
62
- ],
63
- },
74
+ parallel: false , // Disable thread-loader which will cause errors, we are still investigating the root cause
64
75
chainWebpack : (config ) => {
65
76
config .module
66
77
.rule (' vue' )
67
78
.test (/ \. (vue| md)$ / ) // <-- allows Vue to compile Markdown files
79
+
80
+ config
81
+ .plugin (' markdown' )
82
+ .use (Markdown ({
83
+ markdownItUses: [
84
+ prism ,
85
+ ],
86
+ }))
68
87
},
69
88
}
70
89
```
71
90
91
+ Example: [ ` examples/vue-cli ` ] ( ./examples/vue-cli/ )
92
+
72
93
<br ></details >
73
94
74
95
## Import Markdown as Vue components
@@ -160,7 +181,7 @@ npm i @unhead/vue
160
181
``` js
161
182
// vite.config.js
162
183
import Vue from ' @vitejs/plugin-vue'
163
- import Markdown from ' unplugin-vue-markdown'
184
+ import Markdown from ' unplugin-vue-markdown/vite '
164
185
165
186
export default {
166
187
plugins: [
Original file line number Diff line number Diff line change @@ -4,18 +4,18 @@ const prism = require('markdown-it-prism')
4
4
5
5
module . exports = defineConfig ( {
6
6
transpileDependencies : true ,
7
+ parallel : false ,
7
8
chainWebpack : ( config ) => {
8
9
config . module
9
10
. rule ( 'vue' )
10
11
. test ( / \. ( v u e | m d ) $ / )
11
- } ,
12
- configureWebpack ( config ) {
13
- config . plugins . unshift (
14
- Markdown ( {
12
+
13
+ config
14
+ . plugin ( 'markdown' )
15
+ . use ( Markdown ( {
15
16
markdownItUses : [
16
17
prism ,
17
18
] ,
18
- } ) ,
19
- )
19
+ } ) )
20
20
} ,
21
21
} )
You can’t perform that action at this time.
0 commit comments