Nuxt/packages/webpack/src/presets/pug.ts

26 lines
549 B
TypeScript
Raw Normal View History

import type { WebpackConfigContext } from '../utils/config'
2020-09-02 12:27:27 +00:00
export function pug (ctx: WebpackConfigContext) {
ctx.config.module!.rules!.push({
2020-09-02 12:27:27 +00:00
test: /\.pug$/i,
oneOf: [
{
resourceQuery: /^\?vue/i,
use: [{
loader: 'pug-plain-loader',
options: ctx.userConfig.loaders.pugPlain,
}],
2020-09-02 12:27:27 +00:00
},
{
use: [
'raw-loader',
{
loader: 'pug-plain-loader',
options: ctx.userConfig.loaders.pugPlain,
},
],
},
],
2020-09-02 12:27:27 +00:00
})
}