storybookjs / builder-vite

A builder plugin to run and build Storybooks with Vite
MIT License
891 stars 106 forks source link

config.build.target isn't working #57

Open mitow7821 opened 3 years ago

mitow7821 commented 3 years ago

I'am using async viteFinal(config, { configType }) { config.build.target = ""; return config } but if I try run storybook this error shows:

image so I've changed config to config.build = {}; config.build.target = ""; and error disapear, but when i try to deploy stories with chromatic I am getting error because of this two lines (first config works fine in this case)

How to define build.target in config to make it work properly?

eirslett commented 3 years ago

Not sure why this fails... I don't use Chromatic. @shilman can somebody from Chromatic take a look?

shilman commented 3 years ago

On your dev machine, try:

yarn build-storybook
npx http-server storybook-static

Does that work for you? If it does, Chromatic should also work (in theory, in practice there might be subtle differences in the Vite bundle that screw things up?)

mitow7821 commented 3 years ago

Using config.build.target = ""; works on production, but gives error on development: Cannot set property 'target' of undefined

I've made it work on dev only after changing it to: if (configType === "DEVELOPMENT") { config.build = {}; } config.build.target = "";