-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing non TS/JS files giving error #19
Comments
Here's the link of example repo: https://github.com/NajamShehzad/storybook-rsbuild |
Here's the correct config as documented (https://github.com/rspack-contrib/storybook-rsbuild#error-caused-by-bundling-unexpected-files). 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 |
I encountered an issue while working with the project where non-JavaScript or TypeScript files are being parsed, leading to errors.
Here are the details:
It tries to parse all files, including PDFs, text files, and PS1 scripts, within the src folder. I also tried to exclude the tools folder, but it still attempts to parse these files.
I'm not even using these files in the code but they still get pick up and being process
The text was updated successfully, but these errors were encountered: