-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (26 loc) · 1006 Bytes
/
Copy pathindex.js
File metadata and controls
29 lines (26 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module.exports = api => {
api.chainWebpack(webpackConfig => {
// Remove any existing rule added from a previous version of the plugin (npm uninstall/ yarn remove will remove the plugin, but leave behind the webpack rules)
webpackConfig.module.rules.delete('pug')
// Rules taken from: https://vue-loader.vuejs.org/guide/pre-processors.html#pug
webpackConfig.module
.rule('pug')
.test(/\.pug$/)
// this applies to <template lang="pug"> in Vue components
.oneOf('vue-loader')
.resourceQuery(/^\?vue/)
.use('pug-plain')
.loader(require.resolve('pug-plain-loader'))
.end()
.end()
// this applies to pug imports inside JavaScript, i.e. .pug files
.oneOf('raw-pug-files')
.use('pug-raw')
.loader(require.resolve('raw-loader'))
.end()
.use('pug-plain')
.loader(require.resolve('pug-plain-loader'))
.end()
.end()
})
}