我正在尝试将pug的字符串编译为html,因此我尝试在vue模板中导入pug,但它始终会出错。
从“ pug”进口哈巴狗;
所以主要的错误是它说它找不到fs模块,我试图安装它但没有成功。我还尝试将其添加到我的webpack配置中:
mix.webpackConfig({
module: {
rules: [
{
test: /\.pug$/,
oneOf: [
// this applies to `<template lang="pug">` in Vue components
{
resourceQuery: /^\?vue/,
use: ['pug-plain-loader']
},
// this applies to pug imports inside JavaScript
{
use: ['raw-loader', 'pug-plain-loader']
}
]
}
]
}
})
仍然没有结果:/