Example for this pull request storybookjs/vue-cli-plugin-storybook#30
I added DefinePlugin
in vue.config.js
which changes process.env.HOST
to https://example.com
in MyButton
component. This setup works perfectly when running yarn run serve
. However, when running yarn run serve:storybook
, it's doesn't work at all.
- Run
yarn run serve
- Open index page. On top of the page you will see something like this:
HOST: https://example.com Correct?
, which says thatDefinePlugin
works as expected - Run
yarn run serve:storybook
- Open MyButton's story. You will see
HOST: Correct?
, which says thatDefinePlugin
doesn't work - To prove that problem is inside a
vue-cli-plugin-storybook
, I addedDefinePlugin
in storybook's custom webpack config, which you can find here:/config/storybook/webpack.config.js
. Uncomment code insde exported function and run storybook again. You will see thatDefinePlugin
works as expected.
yarn install
yarn run serve
yarn run build
yarn run lint