我已经使用 Nuxt 3 设置了一个独立版本的故事书。一切正常,除了未渲染嵌套组件。例如,<nuxt-link>
打印为<nuxt-link>
.
这是我的故事书main.js
文件的内容:
// const alias = require('../nuxt.config.ts');
const path = require('path');
const alias = require('../config/project').alias;
const css = require('../config/project').css;
css.preprocessorOptions.scss.additionalData = css.preprocessorOptions.scss.additionalData + '@import "assets/tokens/_custom-properties.scss";@import "assets/styles/stories.scss";'
module.exports = {
stories: [
"../stories/**/*.stories.mdx",
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
"../components/**/*.stories.@(js|jsx|ts|tsx)",
],
addons: [
'@storybook/addon-essentials'
],
core: {
builder: "storybook-builder-vite"
},
viteFinal: async (config) => {
config.resolve.alias = {
...config.resolve.alias,
...alias
}
config.css = {
...config.resolve.css,
...css
}
return config;
},
}