Skip to content
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

MillionLint seems to break storybook, at least with redwoodjs #1163

Open
1 task
michalgm opened this issue Dec 17, 2024 · 4 comments
Open
1 task

MillionLint seems to break storybook, at least with redwoodjs #1163

michalgm opened this issue Dec 17, 2024 · 4 comments

Comments

@michalgm
Copy link

What version of million are you using?

1.0.14

Are you using an SSR adapter? If so, which one?

none

What package manager are you using?

yarn

What operating system are you using?

Linux

What browser are you using?

Chrome

Describe the Bug

This may be too specific to worry about, but I just spent a bunch of time debugging why my storybook was no longer running, and it turned out that the culprit was including @milllion/lint in my vite config. I didn't even have it in my plugins list, just importing the library was enough to make it fail.
The specific issue was that the storybook page was 404-ing trying to load http://localhost:7910/sb-addons/essentials-toolbars-4/manager-bundle.js - in fact, the storybook dev process wasn't even creating he web/node_modules/.cache/storybook/public/ directory at all.

dameat@nopants:~/work/memoryhole$ vite --version
vite/5.4.8 linux-x64 node-v22.12.0
dameat@nopants:~/work/memoryhole$ yarn rw --version
8.4.1
dameat@nopants:~/work/memoryhole$ yarn workspace web info storybook --name-only
└─ storybook@npm:7.6.17

I'll attach a log from running DEBUG=* yarn rw storybook &> debug.txt
debug.txt

You can probably reproduce with a fresh redwood installation, enabling miilion in the vite config, and running yarn rw storybook

What's the expected result?

I didn't expect enabling @million/lint in my vite config to affect my ability to run storybook.

Link to Minimal Reproducible Example

See above

Participation

  • I am willing to submit a pull request for this issue.
Copy link

Thanks for opening this issue! A maintainer will review it soon.

@gwansikk
Copy link

gwansikk commented Jan 8, 2025

I have same issue. Even after disabling it in the Vite config, the error still occurs.

MillionLint.vite({
      enabled: false,
    }),

@kimwonj77
Copy link

I had same issue and solve with this cursed code
Here's some workaround for Vite:

export default defineConfig(async ({ mode }) => {
	const millionLintPlugin = await (async () => {
		const isStorybook = process.env.npm_lifecycle_event === "storybook";
		if (isStorybook) {
			return [];
		}

		// This needs to be wrapped because, for some reason, if it gets called anywhere in the root scope, 
		// storybook breaks again... (I don't know why)
		const initMillionLint = async () => {
			const MillionLint = await import("@million/lint");
			return [
				MillionLint.vite({
					enabled: mode === "development",
				}),
			];
		};

		return initMillionLint();
	})();

	return {
		plugins: [
			...millionLintPlugin,
			react(),
                        ...
                ]
        };
}

This code looks bit messy, but it seems that load millionLint at anytime causes an error. So, I had to isolate it…

@mrindzhov
Copy link

Workarounds are mitigating the issue but not solving it.
React + Vite@latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants