Comments (2)
Here's the correct config as documented (https://github.com/rspack-contrib/storybook-rsbuild#error-caused-by-bundling-unexpected-files). source.exclude
won't work here, as it's only for jsx|tsx
files, it still lacks loaders for txt
and ps
files. We will support webpackInclude
magic comment for Rspack to resolve this issue in the future.
import type { StorybookConfig } from 'storybook-react-rsbuild'
import { join, dirname, extname } from 'path'
import { mergeRsbuildConfig } from '@rsbuild/core'
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, 'package.json')))
}
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [
getAbsolutePath('@storybook/addon-onboarding'),
getAbsolutePath('@storybook/addon-links'),
getAbsolutePath('@storybook/addon-essentials'),
getAbsolutePath('@chromatic-com/storybook'),
getAbsolutePath('@storybook/addon-interactions'),
],
framework: {
name: getAbsolutePath('storybook-react-rsbuild'),
options: {},
},
docs: {
autodocs: 'tag',
},
rsbuildFinal: (config) => {
if (!config.source) {
config.source = {}
}
return mergeRsbuildConfig(config, {
tools: {
rspack: (config, { addRules, appendPlugins, rspack, mergeConfig }) => {
return mergeConfig(config, {
plugins: [
new rspack.IgnorePlugin({
checkResource: (resource, context) => {
// for example, ignore all markdown files
const absPathHasExt = extname(resource)
if (absPathHasExt === '.txt' || absPathHasExt === '.ps1') {
return true
}
return false
},
}),
],
})
},
},
})
return config
},
typescript: {
reactDocgen: 'react-docgen',
check: true,
},
}
export default config
from storybook-rsbuild.
Here's the link of example repo: https://github.com/NajamShehzad/storybook-rsbuild
from storybook-rsbuild.
Related Issues (20)
- Not working on Linux HOT 2
- Support Nx HOT 2
- Support for React <18 HOT 5
- Broken with [email protected] HOT 11
- error binding.JsResolverFactory is not a constructor HOT 4
- Compilation error "JavaScript parsing error: Expected ';', got 'assert'" HOT 7
- Very long compilation time and error "Conflict: Multiple assets emit different content to the same filename iframe.html" when source.entry is set in rsbuild config HOT 19
- Error: [html-rspack-plugin]: Child compilation failed HOT 2
- `Conflict: Multiple assets emit different content to the same filename iframe.html` when using custom `source.entry` HOT 3
- Creating new stories and saving stories in UI is not currently supported? HOT 6
- compatibility with storybook-addon-manual-mocks HOT 9
- react-docgen-typescript support? HOT 1
- Cannot find module error with `stories: ['../**/*.stories.ts']`
- Built SB has odd selectors that is being applied HOT 4
- How to use rspack.config.js configuration? HOT 2
- Can't resolve deps with @rsbuild/core 1.0.1-beta.10 HOT 1
- `public/index.html` gets copied instead of the Storybook template when building HOT 6
- CSS imported assets are bundled twice HOT 3
- v0.0.12 breaks dev HOT 11
- Asset loading in CSS doesn't work in dev HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook-rsbuild.