GithubHelp home page GithubHelp logo

storybookjs / builder-vite Goto Github PK

View Code? Open in Web Editor NEW
886.0 13.0 109.0 62.99 MB

A builder plugin to run and build Storybooks with Vite

License: MIT License

JavaScript 1.32% HTML 1.71% TypeScript 96.97%

builder-vite's Introduction

Storybook builder for Vite

Build your stories with vite for fast startup times and near-instant HMR.

Note: This Repository is for Storybook 6.4 and 6.5. In Storybook 7, the Vite builder was brought into the main Storybook monorepo (https://github.com/storybookjs/storybook). See https://storybook.js.org/blog/first-class-vite-support-in-storybook/ for details.

Table of Contents

Installation

Requirements:

npm install @storybook/builder-vite --save-dev

or

yarn add --dev @storybook/builder-vite

or

pnpm add --save-dev @storybook/builder-vite

Note: when using pnpm, you may need to enable shamefully-hoist, until #55 can be fixed.

Usage

In your main.js configuration file, set core: { builder: "@storybook/builder-vite" }.

For autoreload of react stories to work, they need to have a .stories.tsx or .stories.jsx file suffix. See also #53

The builder supports both development mode in Storybook, and building a static production version.

Getting started with Vite and Storybook (on a new project)

See https://vitejs.dev/guide/#scaffolding-your-first-vite-project,

npm create vite@latest # follow the prompts
npx sb init --builder @storybook/builder-vite && npm run storybook

Migration from webpack / CRA

  1. Install vite and @storybook/builder-vite
  2. Remove any explicit project dependencies on webpack, react-scripts, and any other webpack plugins or loaders.
  3. If you were previously using @storybook/manager-webpack5, you'll need to remove it, since currently the vite builder only works with manager-webpack4, which is the default and does not need to be installed manually. Also remove @storybook/builder-webpack5 or @storybook/builder-webpack4 if they are installed.
  4. Set core: { builder: "@storybook/builder-vite" } in your .storybook/main.js file.
  5. Remove storybook webpack cache (rm -rf node_modules/.cache)
  6. Update your /public/index.html file for vite (be sure there are no %PUBLIC_URL% inside it, which is a CRA variable)
  7. Be sure that any files containing JSX syntax use a .jsx or .tsx file extension, which vite requires. This includes .storybook/preview.jsx if it contains JSX syntax.
  8. If you are using @storybook/addon-interactions, for now you'll need to add a workaround for jest-mock relying on the node global variable by creating a .storybook/preview-head.html file containing the following:
<script>
  window.global = window;
</script>
  1. Start up your storybook using the same yarn storybook or npm run storybook commands you are used to.

For other details about the differences between vite and webpack projects, be sure to read through the vite documentation.

Customize Vite config

The builder will not read your vite.config.js file by default.

In .storybook/main.js (or whatever your Storybook config file is named) you can override the Vite config:

// use `mergeConfig` to recursively merge Vite options
const { mergeConfig } = require('vite');

module.exports = {
  async viteFinal(config, { configType }) {
    // return the customized config
    return mergeConfig(config, {
      // customize the Vite config here
      resolve: {
        alias: { foo: 'bar' },
      },
    });
  },
  // ... other options here
};

The viteFinal function will give you config which is the builder's own Vite config. You can tweak this as you want, for example to set up aliases, add new plugins etc.

The configType variable will be either "DEVELOPMENT" or "PRODUCTION".

The function should return the updated Vite configuration.

Svelte Customization

When using this builder with Svelte, your svelte.config.js file will be used automatically.

If you need to make overrides for Storybook, your .storybook/main.js (or equivalent) can contain a svelteOptions object to pass custom options to vite-plugin-svelte:

const preprocess = require('svelte-preprocess');

module.exports = {
  svelteOptions: {
    preprocess: preprocess({
      typescript: true,
      postcss: true,
      sourceMap: true,
    }),
  },
};

TypeScript

Configure your .storybook/main.ts to use TypeScript:

import type { StorybookViteConfig } from '@storybook/builder-vite';

const config: StorybookViteConfig = {
  // other storybook options...,
  async viteFinal(config, options) {
    // modify and return config
  },
};

export default config;

Or alternatively, you can use named exports:

import type { ViteFinal } from '@storybook/builder-vite';

export const viteFinal: ViteFinal = async (config, options) => {
  // modify and return config
};

See Customize Vite config for details about using viteFinal.

React Docgen

Docgen is used in Storybook to populate the props table in docs view, the controls panel, and for several other addons. Docgen is supported in vue and react, and there are two docgen options when using react, react-docgen and react-docgen-typescript. You can learn more about the pros/cons of each in this gist. By default, if we find a typescript dependency in your package.json file, we will assume you're using typescript and will choose react-docgen-typescript. You can change this by setting the typescript.reactDocgen option in your .storybook/main.js file:

module.exports = {
  typescript: {
    reactDocgen: 'react-docgen',
  },
};

If you're using TypeScript, we encourage you to experiment and see which option works better for your project.

Note about working directory

The builder will by default enable Vite's server.fs.strict option, for increased security. The default project root is set to the parent directory of the storybook configuration directory. This can be overridden in viteFinal.

Known issues

  • HMR: saving a story file does not hot-module-reload, a full reload happens instead. HMR works correctly when saving component files.

Migration from storybook-builder-vite

This project has moved from storybook-builder-vite to @storybook/builder-vite as part of a larger effort to improve Vite support in Storybook. To automatically migrate your existing project, you can run

npx sb@next automigrate

To manually migrate:

  1. Remove storybook-builder-vite from your package.json dependencies
  2. Install @storybook/builder-vite
  3. Update your core.builder setting in .storybook/main.js to @storybook/builder-vite.

Contributing

The Vite builder cannot build itself. Are you willing to contribute? We are especially looking for vue and svelte experts, as the current maintainers are react users.

#11

Have a look at the GitHub issues for known bugs. If you find any new bugs, feel free to create an issue or send a pull request!

Please read the How to contribute guide.

About this codebase

The code is a monorepo with the core @storybook/builder-vite package, and examples (like examples/react) to test the builder implementation.

Similar to the main storybook monorepo, you need yarn to develop this builder, because the project is organized as yarn workspaces. This lets you write new code in the core builder package, and instantly use them from the example packages.

builder-vite's People

Contributors

andrewcourtice avatar benatshippabo avatar benmccann avatar bfanger avatar bodograumann avatar dimfeld avatar dohooo avatar dschungelabenteuer avatar eirslett avatar guygool5 avatar ianvs avatar j3rem1e avatar joshwooding avatar kazuma1989 avatar kvcvc avatar lokshunhung avatar maxbeatty avatar mrauhu avatar offlinehacker avatar razor1895 avatar rqbazan avatar schalk-b avatar sevenfields-matt avatar shaal avatar shilman avatar simenbrekken avatar smileyjames avatar thecomputerm avatar tobiasdiez avatar troyvassalotti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

builder-vite's Issues

Fix the a11y addon

@storybook/addon-a11y error

a11yRunner.js:10 Uncaught SyntaxError: The requested module '/@fs/Users/zander/code/my/project/node_modules/@storybook/addon-a11y/node_modules/axe-core/axe.js?v=ad04bc2d' does not provide an export named 'default'

Originally posted by @mrmartineau in #4 (comment)

Support with Ember

Hey there,

thanks a lot for getting startet with vite and storybook. I was eager to try it out with ember today.

Some facts about my storybook setup:

  • I do not use mdx (not suitable for me/ember)
  • I do not use @storybook/addon-docs addon (for mostly the same reason)

Things I had to do when installing:

  • Manually add @mdx-js/react dependency to my package
  • Manually add @storybook/addon-docs dependency to my package

Seems like, this package relies on them, without making them a dependency.

After adding them, I at least could start storybook. I have a markdown -> story transformation, so I can write docs in markdown only. This seems like to be a problem for vite (?) to pick it up? At least, this is where I'm seeing errors:

13:09:10 [vite] new dependencies found: @storybook/ember, updating...
13:09:12 [vite] โœจ dependencies updated, reloading page...
13:09:13 [vite] Internal server error: unknown: Expected corresponding JSX closing tag for <br>. (23:62)

  21 | <p parentName="li"><a parentName="p" {...{"href":"https://gos.si/blog/full-featured-themes-in-figma/"}}>{`Full Featured Themes in Figma`}</a><br>{`
  22 | This article will talk about design tokens, references of such and different
> 23 | contexts within one theme and how to organize them in Figma.`}</p>
     |                                                               ^
  24 | </li>
  25 | <li parentName="ul">
  26 | <p parentName="li"><a parentName="p" {...{"href":"https://gos.si/blog/say-hello-to-theemo-the-yordle-powered-theme-automator/"}}>{`Say Hello to Theemo โ€“ the Yordle Powered Theme
  Plugin: vite-plugin-mdx
  File: /Users/thomas/code/hokulea/hokulea/documentation/backstage/making-of.md
  27 |
  28 |  - [Integrate Ember with the JS Ecosystem at the Example of
  29 |    Theemo](https://gos.si/blog/integrate-ember-with-the-js-ecosystem-at-the-example-of-theemo/)<br>
     |                                                     ^
  30 |    Explains how to bring design tokens from Figma to Ember and develop libraries
  31 |    for the greater npm system rather for ember only.
      at Object._raise (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:816:17)
      at Object.raiseWithData (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:809:17)
      at Object.raise (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:770:17)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5207:16)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5175:32)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5175:32)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5175:32)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5175:32)
      at Object.jsxParseElement (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5233:17)
      at Object.parseExprAtom (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5240:19)
      at Object.parseExprSubscripts (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10878:23)
      at Object.parseUpdate (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10858:21)
      at Object.parseMaybeUnary (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10836:23)
      at Object.parseExprOps (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10693:23)
      at Object.parseMaybeConditional (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10667:23)
      at Object.parseMaybeAssign (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10630:21)

And this one:

13:09:13 [vite] Internal server error: unknown: Unexpected token (14:72)

  12 | <pre><code parentName="pre" {...{"className":"language-typescript"}}>{`export default class CheckboxComponent extends Component<CheckboxArgs>
  13 | `}</code></pre>
> 14 | <b>Extends:</b> Component&lt;[CheckboxArgs](./controls.checkboxargs.md)<!-- -->&gt;
     |                                                                         ^
  15 | <h2>{`Remarks`}</h2>
  16 | <p><a parentName="p" {...{"href":"https://www.figma.com/file/Fq29S0hD3i38bAjYz3wWwy/Components?node-id=404%3A411"}}>{`Design in Figma`}</a></p>
  17 | <h2>{`Example 1`}</h2>
  Plugin: vite-plugin-mdx
  File: /Users/thomas/code/hokulea/hokulea/api/controls.checkboxcomponent.md
  35 |  ## Example 2
  36 |
  37 |  Sizing - Use `font-size` for sizing. Using the [style modifier](https://github.com/jelhan/ember-style-modifier) in this example:
     |        ^
  38 |
  39 |  ```hbs
      at Object._raise (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:816:17)
      at Object.raiseWithData (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:809:17)
      at Object.raise (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:770:17)
      at Object.unexpected (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:9905:16)
      at Object.jsxParseIdentifier (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5018:12)
      at Object.jsxParseNamespacedName (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5028:23)
      at Object.jsxParseElementName (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5039:21)
      at Object.jsxParseOpeningElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5126:22)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5159:33)
      at Object.jsxParseElementAt (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5175:32)
      at Object.jsxParseElement (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5233:17)
      at Object.parseExprAtom (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:5240:19)
      at Object.parseExprSubscripts (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10878:23)
      at Object.parseUpdate (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10858:21)
      at Object.parseMaybeUnary (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10836:23)
      at Object.parseExprOps (/Users/thomas/code/hokulea/hokulea/node_modules/@babel/parser/lib/index.js:10693:23)

References to my storybook (which is OSS)

this is showing storybook 6.1, I tried locally with 6.3 and the loaders listed above haven't changed since then.

I dunno how I can help here, so please let me know :)

Incompatibility when using with existing components (Error: 'default' is not exported by...)

I tried running our component library (using Storybook) with this, and got quite far!
start-storybook is working perfectly fine, but when trying build-storybook I'm not getting a successful build.

This is probably related to our setup / our components (a private Github repo, unfortunately), as the example (as per README) is working completely fine for me.

The error in question is the following:

info @storybook/react v6.3.0-alpha.14
info
info => Cleaning outputDir: /home/julrich/Projects/Frontend/code/project/dist
info => Copying static files: ./legacy-instance => ./
info => Loading presets
info => Compiling manager..
vite v2.2.1 building for production...
transforming (1312) ../../@storybook/addon-essentials/node_modules/@storybook/components/dist/esm/controls/react-editable-json-tree/components/JsonArray.jsConflicting namespaces: node_modules/@storybook/client-api/dist/esm/index.js re-exports 'combineParameters' from both node_modules/@storybook/client-api/dist/esm/index.js and node_modules/@storybook/client-api/dist/esm/parameters.js (will be ignored)
transforming (1941) ../../lodash/_baseFindIndex.jsConflicting namespaces: node_modules/@storybook/addon-essentials/node_modules/@storybook/components/dist/esm/index.js re-exports 'components' from both node_modules/@storybook/addon-essentials/node_modules/@storybook/components/dist/esm/index.js and node_modules/@storybook/addon-essentials/node_modules/@storybook/components/dist/esm/typography/DocumentFormatting.js (will be ignored)
transforming (1987) ../../../packages/components/blog/lib/news-list/news-list.cssUse of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Error when using sourcemap for reporting an error: Can't resolve original location of error.
โœ“ 1989 modules transformed.
'default' is not exported by /home/julrich/Projects/Frontend/code/project/node_modules/core-js-pure/features/object/get-own-property-symbols.js?commonjs-proxy, imported by node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js
file: /home/julrich/Projects/Frontend/code/project/node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js:2:7
1: import 'core-js-pure/features/object/get-own-property-symbols?commonjs-require';
2: import require$$0 from 'core-js-pure/features/object/get-own-property-symbols?commonjs-proxy';
          ^
3:
4: var getOwnPropertySymbols = require$$0;
ERR! Error: 'default' is not exported by /home/julrich/Projects/Frontend/code/project/node_modules/core-js-pure/features/object/get-own-property-symbols.js?commonjs-proxy, imported by node_modules/@babel/runtime-corejs3/core-js/object/get-own-property-symbols.js
ERR!     at error (/home/julrich/Projects/Frontend/code/project/node_modules/rollup/dist/shared/rollup.js:5305:30)
ERR!     at Module.error (/home/julrich/Projects/Frontend/code/project/node_modules/rollup/dist/shared/rollup.js:9750:16)
ERR!     at Module.traceVariable (/home/julrich/Projects/Frontend/code/project/node_modules/rollup/dist/shared/rollup.js:10138:29)
ERR!     at ModuleScope.findVariable (/home/julrich/Projects/Frontend/code/project/node_modules/rollup/dist/shared/rollup.js:8899:39)
ERR!     at Identifier.bind (/home/julrich/Projects/Frontend/code/project/node_modules/rollup/dist/shared/rollup.js:4035:40)

Not sure what might cause this. Already tried debugging it with VSCode, and looking at the generated source.
If these are features we're utilizing in our components, I'd be happy to get rid of them / replace them. Just no real idea on where to start hunting!

The requested module does not provide an export named 'default'

Switching from the regular builder, I removed storybook from my project and re-installed it using

npx sb@next init --builder storybook-builder-vite

.storybook/main.js module.exports = { core: { builder: "storybook-builder-vite" }, async viteFinal(config, { configType }) { // customize the Vite config here config.resolve.alias = { ...config.resolve.alias, ...absolutePathAliases };
// return the customized config
return config;

},
stories: [
"../src//*.stories.mdx",
"../src/
/*.stories.@(js|jsx|ts|tsx)"
],
addons: [
"@storybook/addon-actions",
"@storybook/addon-essentials",
"storybook-addon-intl",
{
name: '@storybook/addon-postcss',
options: {
postcssLoaderOptions: {
implementation: require('postcss'),
},
},
},
],
typescript: {
check: false,
checkOptions: {},
reactDocgen: 'react-docgen-typescript',
},
}

When starting storybook I have no error, but when I open storybook in the browser I get this error :

Uncaught SyntaxError: The requested module '/node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js?v=403370d2' does not provide an export named 'default' coming from emotion-theming.browser.esm.js?v=403370d2

I'm not sure if this issue is related to this repo directly but I have to start somewhere :)

Remove some dependencies

Adding the storybook framework addons and plugins was a mistake, I think. I've tried out the latest version of this builder, and now storybook thinks I'm a svelte project, when really I'm using react. It seems this is because storybook-builder-vite depends on @storybook/addon-svelte-csf, which in turn brings in @storybook/svelte, and storybook uses the presence of a framework library to determine what to run, and it blows up in my react project.

I'm kind of wondering if maybe we should leave it up to the consumer to add the plugins that they need for their framework. We can document the recommendations for the various frameworks, but then leave it up to users to add them. It's likely they'll already be using them in their production app already, after all.

The other possibility is to try to read their vite.config file and automatically extend that. But that's maybe a bigger step than we should try taking right now.

Or, we can remove the dependencies from our package.json, but still try to require them and add them in the config, maybe with a try/catch to throw a friendly message if they're not found. I'd suggest peerDependencies, but that's turned into a complete dumpster fire.

codeSource doesn't work

Hi ๐Ÿ‘‹

It is impossible to show the source code of the component (vue 3).
Capture dโ€™eฬcran 2021-06-24 aฬ€ 17 46 26

any idea why this is not working?

npm init @vitejs/app my-vite-app
npx sb@next init --builder storybook-builder-vite
npm run storybook

Thx

Error using vite-plugin-mdx

Hi, firstly this is awesome! It feels so good to be able to storybook in my vite app finally ๐ŸŽ‰ and it's lightning fast too.

So I'm using vite-plugin-mdx in my app to import mdx files and render them as react components. But if I add it to the plugins in storybook I get this error:

[vite] Internal server error: ENOENT: no such file or directory, open '/home/jellis/code/stop-n-swop/ui/src/ui/help/checkout/complete.mdx.js'

My .storybook/main.js:

const svg = require('vite-plugin-react-svg');
const mdx = require('vite-plugin-mdx').default;

module.exports = {
  stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
  addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
  core: {
    builder: 'storybook-builder-vite',
  },
  viteFinal: (config, { configType }) => {
    config.resolve.alias = {
      ...config.resolve.alias,
      infrastructure: '/src/infrastructure',
      core: '/src/core',
      domain: '/src/domain',
      application: '/src/application',
      ui: '/src/ui',
      crosscutting: '/src/crosscutting',
    };
    config.plugins = [
      svg({
        defaultExport: 'component',
        expandProps: 'end',
      }),
      ...config.plugins,
      mdx(),
    ];
    return config;
  },
};

any ideas?

Rollup failed to resolve import "{}" from "node_modules/@storybook/client-logger/dist/esm/index.js"

Hey! Having issues trying to build storybook. I recreated the issue in a stackblitz:
https://stackblitz.com/edit/storybook-vite-builder-client-logger-build-bug?file=package.json

Running storybook in dev works OK locally (stackblitz seems to be choking on installing esbuild), but the npm run build-storybook command errors out the same way I'm experiencing locally and hope it's enough of a clue.

[vite]: Rollup failed to resolve import "{}" from "node_modules/@storybook/client-logger/dist/esm/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
ERR! Error: [vite]: Rollup failed to resolve import "{}" from "node_modules/@storybook/client-logger/dist/esm/index.js".
ERR! This is most likely unintended because it can break your application at runtime.
ERR! If you do want to externalize this module explicitly add it to
ERR! `build.rollupOptions.external`
Full command output
โฏ npm run build-storybook
$ build-storybook -s public
info @storybook/react v6.3.4
info 
info => Cleaning outputDir: /home/projects/storybook-vite-builder-client-logger-build-bug/storybook-static
info => Copying static files: ./public => ./
info => Loading presets
info => Compiling manager..
vite v2.4.2 building for production...
โœ“ 15 modules transformed.
[vite]: Rollup failed to resolve import "{}" from "node_modules/@storybook/client-logger/dist/esm/index.js".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
ERR! Error: [vite]: Rollup failed to resolve import "{}" from "node_modules/@storybook/client-logger/dist/esm/index.js".
ERR! This is most likely unintended because it can break your application at runtime.
ERR! If you do want to externalize this module explicitly add it to
ERR! `build.rollupOptions.external`
ERR!     at onRollupWarning (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/vite/dist/node/chunks/dep-11db14da.js:51691:19)
ERR!     at onwarn (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/vite/dist/node/chunks/dep-11db14da.js:51481:13)
ERR!     at Object.eval [as onwarn] (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:20470:13)
ERR!     at ModuleLoader.handleResolveId (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19819:26)
ERR!     at eval (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19766:22)
ERR!     at async Promise.all (index 8)
ERR!     at async ModuleLoader.fetchStaticDependencies (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19764:34)
ERR!     at async Promise.all (index 0)
ERR!     at async ModuleLoader.fetchModule (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19740:9)
ERR!     at async Promise.all (index 2)
ERR!     at async ModuleLoader.fetchStaticDependencies (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19764:34)
ERR!     at async Promise.all (index 0)
ERR!     at async ModuleLoader.fetchModule (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19740:9)
ERR!     at async Promise.all (index 0)
ERR!     at async ModuleLoader.fetchStaticDependencies (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19764:34)
ERR!     at async Promise.all (index 0)
ERR!  Error: [vite]: Rollup failed to resolve import "{}" from "node_modules/@storybook/client-logger/dist/esm/index.js".
ERR! This is most likely unintended because it can break your application at runtime.
ERR! If you do want to externalize this module explicitly add it to
ERR! `build.rollupOptions.external`
ERR!     at onRollupWarning (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/vite/dist/node/chunks/dep-11db14da.js:51691:19)
ERR!     at onwarn (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/vite/dist/node/chunks/dep-11db14da.js:51481:13)
ERR!     at Object.eval [as onwarn] (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:20470:13)
ERR!     at ModuleLoader.handleResolveId (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19819:26)
ERR!     at eval (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19766:22)
ERR!     at async Promise.all (index 8)
ERR!     at async ModuleLoader.fetchStaticDependencies (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19764:34)
ERR!     at async Promise.all (index 0)
ERR!     at async ModuleLoader.fetchModule (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19740:9)
ERR!     at async Promise.all (index 2)
ERR!     at async ModuleLoader.fetchStaticDependencies (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19764:34)
ERR!     at async Promise.all (index 0)
ERR!     at async ModuleLoader.fetchModule (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19740:9)
ERR!     at async Promise.all (index 0)
ERR!     at async ModuleLoader.fetchStaticDependencies (/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/rollup/dist/shared/rollup.js:19764:34)
ERR!     at async Promise.all (index 0) {
ERR!   watchFiles: [
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/iframe.html',
ERR!     '/virtual:/@storybook/builder-vite/vite-app.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/react/dist/esm/client/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-logger/dist/esm/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/.storybook/preview.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/frameworks/react/config.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-links/dist/esm/preset/addDecorator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-actions/dist/esm/preset/addDecorator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-actions/dist/esm/preset/addArgs.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addDecorator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addParameter.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-measure/dist/esm/preset/preview.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/storybook-addon-outline/dist/esm/preset/addDecorator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/components/Button/Button.stories.tsx',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/react/dist/esm/client/preview/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/react/dist/esm/client/preview/types-6-3.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/client_api.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/decorators.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/parameters.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/story_store.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/config_api.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/pathToId.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/simulate-pageload.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/queryparams.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/filterArgTypes.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/hooks.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/types.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/client-api/dist/esm/inferControls.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.array.concat.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.set.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.object.to-string.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.string.iterator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.array.iterator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/web.dom-collections.iterator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.string.replace.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/core-js/modules/es.regexp.exec.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/blocks/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/enhanceArgTypes.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/frameworks/react/extractArgTypes.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/lib/docgen/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-docs/dist/esm/frameworks/react/jsxDecorator.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-links/dist/esm/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-actions/dist/esm/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-actions/dist/esm/preset/addArgsHelpers.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-backgrounds/dist/esm/decorators/index.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/@storybook/addon-measure/dist/esm/withMeasure.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/storybook-addon-outline/dist/esm/withOutline.js',
ERR!     '/home/projects/storybook-vite-builder-client-logger-build-bug/node_modules/storybook-addon-outline/dist/esm/constants.js'
ERR!   ]
ERR! }

Support vite 2.4

There are some breaking changes in the way that file serving boundaries are secured, which we will need to update our config to handle. Since we don't control the version of vite that is being used, we may also need to support both config options.

Storybook 6.2.9 seems to try to load storybook-builder-vite from an incorrect module

I'm testing out storybook-builder-vite in a skeleton sveltekit project.

In the instructions, .storybook/main.js (.storybook/main.cjs for me) should be configured as

  core: {
    builder: 'storybook-builder-vite',
  },

However, storybook 6.2.9 seems to interpolate this configuration into the module name @storybook/builder-storybook-builder-vite.

As a workaround, I installed storybook-builder-vite with an alias using the following.

npm i -D @storybook/builder-storybook-builder-vite@npm:storybook-builder-vite

Support legacy storiesOf

Trying to convert from Webpack to Vite, I'm seeing this error:

Uncaught Error: Cannot add an argTypes enhancer to the store after a story has been added.
    at StoryStore2.addArgTypesEnhancer3 (story_store.js:536)
    at ClientApi2.addArgTypesEnhancer (client_api.js:132)
    at addArgTypesEnhancer2 (client_api.js:72)
    at vite-app.js:61

It's caused by having a storiesOf entry in a story file.

import React from 'react';
import { storiesOf } from '@storybook/react';

storiesOf('Dynamic', module).add('Story', () => <div>Test</div>);

I'm guessing it's because module is undefined in the Vite context, but not sure what (if anything) to replace it with.

While it is a legacy API, it is also still the only way to add a dynamic list of stories (something that fits perfectly with import.meta.globEager).

Controls not automatically generated for Single File Components

Hi

Thanks so much for writing this builder for Storybook! Being able to use Vite is so much better!

I am having an issue with getting controls to automatically generate for single file components though.

I have followed the setup guide for getting started using Storybook with Vue 3, Vite and TypeScript. Everything is running ok except I cannot get my story to automatically generate controls (or source) based on the components props.

I've had controls configured using the argTypes property but as far as I am aware Storybook should be able to generate these out of the box based on the components props?

I have been hunting through documentation and addons but can't find anything. Any help would be much appreciated.

Here is my current setup:

Storybook Packages:

  • "@babel/core": "^7.14.6"
  • "@storybook/addon-actions": "^6.3.0"
  • "@storybook/addon-essentials": "^6.3.0"
  • "@storybook/addon-links": "^6.3.0"
  • "@storybook/vue3": "^6.3.0"
  • "babel-loader": "^8.2.2"
  • "storybook-builder-vite": "^0.0.9"
  • "typescript": "^4.3.2"

main.js:

module.exports = {
    "stories": [
        "../src/**/*.stories.mdx",
        "../src/**/*.stories.@(js|jsx|ts|tsx)"
    ],
    "addons": [
        "@storybook/addon-links",
        "@storybook/addon-essentials"
    ],
    "core": {
        "builder": "storybook-builder-vite"
    }
};

preview.js:

export const parameters = {
    actions: {
        argTypesRegex: "^on[A-Z].*"
    },
    controls: {
        expanded: true,
        matchers: {
            color: /(background|color)$/i,
            date: /Date$/,
        },
    },
};

The source component props:

props: {

    /**
        * The unique id of this dropdown panel
    */
    id: {
        type: String,
        default: () => stringUniqueId(6),
    },

    /**
        * Where the dropdown panel originates from.
        * This could also be described as it's anchor point.
    */
    origin: {
        type: String as PropType<Origin>,
        default: 'bottom-centre',
    },

    /**
    * A boolean indicating whether this dropdown panel should be teleported
    */
    teleport: {
        type: Boolean,
        default: false,
    },

    /**
    * A boolean indicating whether the panel should automatically
    * close when an item within the panel is clicked.
    */
    autoClose: {
        type: Boolean,
        default: true,
    },

    /**
        * A value indicating how autofocus should behave within the panel
    */
    autoFocus: {
        type: [Boolean, String],
        default: 'input[type="text"]|[active]|:focusable',
    },

    /**
        * A value indicating whether the dropdown panel should automatically trap focus upon opening
    */
    focusTrap: {
        type: Boolean,
        default: true,
    },

},

The story for this component:

import DropdownPanel from '../../components/dropdown-panel/dropdown-panel.vue';

import template from './templates/default.html?raw';
import hero from '../_base/decorators/hero';

import {
    Meta,
    Story,
} from '@storybook/vue3';

export default {
    title: 'Dropdown Panel',
    component: DropdownPanel,
    decorators: [ hero ],
} as Meta;

const Component: Story = args => ({

    template,

    components: {
        DropdownPanel,
    },

    setup() {
        return {
            args,
        };
    },

});

export const Basic = Component.bind({});

Screenshot showing no controls:
storybook

Am I missing something completely obvious?

Storybook pulls my tests

I'm attempting to migrate from the default builder to vite.
For some reason, storybook shows some error about @testing-library/dom and pretty-format. They should be not there in the first place because those are testing only libraries. I tried to include or exclude them from optimizeDeps without success.
I don't understand why it tries to pull them. Maybe it pulls all the tsconfig files, I don't know. I have 3 tsconfig files at the root of my project, one for dev, one for tests and one for eslint.

Edit : I talked about this issue here : testing-library/dom-testing-library#985

main.ts typescript not working

On a fresh project:

Rename: .storybook/main.js to .storybook/main.ts
Change the content to:

let myVar: string = 'test'
console.log(myVar)

module.exports = {
  "stories": [
    "../src/**/*.stories.mdx",
    "../src/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  "addons": [
    "@storybook/addon-links",
    "@storybook/addon-essentials"
  ],
  "core": {
    "builder": "storybook-builder-vite"
  }
}

Run
npm run storybook

Outputs:

ERR! SyntaxError: <repo path>\.storybook\main.ts: Missing semicolon. (1:9)
ERR!
ERR! > 1 | let myVar: string = 'test'
ERR!     |          ^
ERR!   2 | console.log(myVar)

config.build.target isn't working

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?

storybook is picking index.html

Normally when vite starts it picks up index.html from root folder as mentioned here

But for storybook it shouldn't start with that index.html, I guess that is what iframe.html is for. However this is what happens. index.html in root folder is for app's use only, not for storybook. How to prevent that from loading?

Backgrounds Addon custom values not working

When using the vite builder the values array is ignored when customizing the backgrounds addon configuration, the default key works fine.

I'm using this config:

export const parameters = {
  actions: { argTypesRegex: "^on[A-Z].*" },
  controls: {
    matchers: {
      color: /(background|color)$/i,
      date: /Date$/,
    },
  },
  backgrounds: {
    default: "white",
    values: [
      {
        name: "light",
        value: "#f8f8f8"
      },
      {
        name: "dark",
        value: "#333333"
      },
      {
        name: "white",
        value: "#ffffff"
      },
    ]
  },
}

I get this error in the console when using the vite builder with this configuration
image

If I disable the vite builder by commenting the core": { "builder": "storybook-builder-vite" } line in main.js the addon works as expected, the "white" color is present and is the default.

Repo showing the bug: https://github.com/giubatt/sb-vite-background
I created a vite project from scratch, added storybook with vite builder and added the backgrounds addon config.

Storybook Vite 2x slower than the default

After migrating from the default builder to the vite builder, it now takes 4sec to refresh the page after updating a class in a component, when it took 2sec before.

The startup still mentions webpack so I'm a bit confused, I don't know if it's supposed to do that.
Also after updating the component, a simple class replacement, 787 requests are made. About half of them are cached but since the browsers have a limit of 9 concurrent requests, it still takes time to process them. Maybe it is a HMR issue.

Is it normal to have mentions of webpack during startup ?
It is normal to have so many requests after a component update ?
What can I do to investigate ?

Storybook startup
info @storybook/react v6.3.1
info 
info => Loading presets
info Found existing addon "@storybook/addon-actions", skipping.

info => Ignoring cached manager due to change in manager config
โ„น ๏ฝขwdm๏ฝฃ: wait until bundle finished: 
โ„น ๏ฝขwdm๏ฝฃ: wait until bundle finished: /__vite_ping
Pre-bundling dependencies:
  tslib
  connected-react-router
  react
  react-dom
  react-intl
  (...and 114 more)
(this will be run only when your dependencies or config have changed)
โ„น ๏ฝขwdm๏ฝฃ: Hash: 86474cd905d0a95ab1be
Version: webpack 4.46.0
Time: 5873ms
Built at: 06/30/2021 5:40:41 PM
                         Asset      Size        Chunks                    Chunk Names
           0.manager.bundle.js   113 KiB             0  [emitted]         
           1.manager.bundle.js   197 KiB             1  [emitted]         
           2.manager.bundle.js  67.6 KiB             2  [emitted]         
           3.manager.bundle.js   373 KiB             3  [emitted]  [big]  
           4.manager.bundle.js  15.9 KiB             4  [emitted]         
           5.manager.bundle.js  1.36 KiB             5  [emitted]         
                    index.html  3.37 KiB                [emitted]         
        main.manager.bundle.js  4.88 KiB          main  [emitted]         main
runtime~main.manager.bundle.js  8.95 KiB  runtime~main  [emitted]         runtime~main
vendors~main.manager.bundle.js  4.61 MiB  vendors~main  [emitted]  [big]  vendors~main
Entrypoint main [big] = runtime~main.manager.bundle.js vendors~main.manager.bundle.js main.manager.bundle.js
[0] multi ./node_modules/@storybook/core-client/dist/esm/globals/polyfills.js ./node_modules/@storybook/core-client/dist/esm/manager/index.js ./node_modules/@storybook/addon-actions/dist/esm/register.js ./node_modules/@storybook/addon-docs/dist/esm/register.js ./node_modules/@storybook/addon-controls/dist/esm/register.js ./node_modules/@storybook/addon-backgrounds/dist/esm/register.js ./node_modules/@storybook/addon-viewport/dist/esm/register.js ./node_modules/@storybook/addon-toolbars/dist/esm/register.js ./node_modules/@storybook/addon-measure/dist/esm/preset/manager.js ./node_modules/storybook-addon-outline/dist/esm/preset/register.js ./node_modules/storybook-addon-intl/register.js 148 bytes {main} [built]
[./node_modules/@storybook/addon-actions/dist/esm/constants.js] 239 bytes {vendors~main} [built]
[./node_modules/@storybook/addon-actions/dist/esm/register.js] ./node_modules/@storybook/addon-actions/dist/esm/register.js + 4 modules 96 KiB {vendors~main} [built]
    | ./node_modules/@storybook/addon-actions/dist/esm/register.js 3.36 KiB [built]
    | ./node_modules/@storybook/addon-actions/dist/esm/containers/ActionLogger/index.js 7.13 KiB [built]
    | ./node_modules/@storybook/addon-actions/dist/esm/components/ActionLogger/index.js 2.94 KiB [built]
    | ./node_modules/react-inspector/dist/es/react-inspector.js 81.7 KiB [built]
    | ./node_modules/@storybook/addon-actions/dist/esm/components/ActionLogger/style.js 793 bytes [built]
[./node_modules/@storybook/addon-backgrounds/dist/esm/register.js] ./node_modules/@storybook/addon-backgrounds/dist/esm/register.js + 5 modules 14.7 KiB {vendors~main} [built]
    | ./node_modules/@storybook/addon-backgrounds/dist/esm/register.js 826 bytes [built]
    | ./node_modules/@storybook/addon-backgrounds/dist/esm/constants.js 185 bytes [built]
    | ./node_modules/@storybook/addon-backgrounds/dist/esm/containers/BackgroundSelector.js 6.46 KiB [built]
    | ./node_modules/@storybook/addon-backgrounds/dist/esm/containers/GridSelector.js 3.44 KiB [built]
    | ./node_modules/@storybook/addon-backgrounds/dist/esm/components/ColorIcon.js 399 bytes [built]
    | ./node_modules/@storybook/addon-backgrounds/dist/esm/helpers/index.js 3.31 KiB [built]
[./node_modules/@storybook/addon-controls/dist/esm/register.js] ./node_modules/@storybook/addon-controls/dist/esm/register.js + 20 modules 103 KiB {vendors~main} [built]
    | ./node_modules/@storybook/addon-controls/dist/esm/register.js 1.18 KiB [built]
    | ./node_modules/@storybook/addon-controls/dist/esm/constants.js 74 bytes [built]
    | ./node_modules/@storybook/addon-controls/dist/esm/ControlsPanel.js 4.35 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/addon-panel/addon-panel.js 908 bytes [built]
    | ./node_modules/@storybook/components/dist/esm/typography/DocumentFormatting.js 13.9 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/typography/shared.js 1.42 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/blocks/Source.js 3.21 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/blocks/ArgsTable/NoControlsWarning.js 862 bytes [built]
    | ./node_modules/markdown-to-jsx/dist/index.module.js 14.6 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/controls/options/Options.js 3.02 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/blocks/EmptyBlock.js 1.22 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/blocks/ArgsTable/ArgsTable.js 16.5 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/controls/options/Checkbox.js 5.09 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/controls/options/Radio.js 2.01 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/controls/options/Select.js 4.73 KiB [built]
    |     + 6 hidden modules
[./node_modules/@storybook/addon-docs/dist/esm/register.js] ./node_modules/@storybook/addon-docs/dist/esm/register.js + 1 modules 1020 bytes {vendors~main} [built]
    | ./node_modules/@storybook/addon-docs/dist/esm/register.js 625 bytes [built]
    | ./node_modules/@storybook/addon-docs/dist/esm/shared.js 380 bytes [built]
[./node_modules/@storybook/addon-measure/dist/esm/preset/manager.js] ./node_modules/@storybook/addon-measure/dist/esm/preset/manager.js + 3 modules 4.1 KiB {vendors~main} [built]
    | ./node_modules/@storybook/addon-measure/dist/esm/preset/manager.js 425 bytes [built]
    | ./node_modules/@storybook/addon-measure/dist/esm/constants.js 249 bytes [built]
    | ./node_modules/@storybook/addon-measure/dist/esm/Tool.js 2.38 KiB [built]
    | ./node_modules/@storybook/addon-measure/dist/esm/useHotKey.js 1.03 KiB [built]
[./node_modules/@storybook/addon-toolbars/dist/esm/register.js] ./node_modules/@storybook/addon-toolbars/dist/esm/register.js + 10 modules 18 KiB {vendors~main} [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/register.js 467 bytes [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/constants.js 76 bytes [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/components/ToolbarManager.js 1.39 KiB [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/components/ToolbarMenuList.js 4.73 KiB [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/utils/normalize-toolbar-arg-type.js 1.05 KiB [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/components/ToolbarMenuButton.js 625 bytes [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/hoc/withKeyboardCycle.js 5.03 KiB [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/utils/get-selected-icon.js 372 bytes [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/components/ToolbarMenuListItem.js 979 bytes [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/utils/create-cycle-value-array.js 524 bytes [built]
    | ./node_modules/@storybook/addon-toolbars/dist/esm/utils/register-shortcuts.js 2.69 KiB [built]
[./node_modules/@storybook/addon-viewport/dist/esm/register.js] ./node_modules/@storybook/addon-viewport/dist/esm/register.js + 4 modules 18.7 KiB {vendors~main} [built]
    | ./node_modules/@storybook/addon-viewport/dist/esm/register.js 514 bytes [built]
    | ./node_modules/@storybook/addon-viewport/dist/esm/constants.js 316 bytes [built]
    | ./node_modules/@storybook/addon-viewport/dist/esm/Tool.js 10.9 KiB [built]
    | ./node_modules/@storybook/addon-viewport/dist/esm/shortcuts.js 3.81 KiB [built]
    | ./node_modules/@storybook/addon-viewport/dist/esm/defaults.js 2.98 KiB [built]
[./node_modules/@storybook/addons/dist/esm/public_api.js] ./node_modules/@storybook/addons/dist/esm/public_api.js + 1 modules 766 bytes {vendors~main} [built]
    | ./node_modules/@storybook/addons/dist/esm/public_api.js 515 bytes [built]
    | ./node_modules/@storybook/addons/dist/esm/storybook-channel-mock.js 226 bytes [built]
[./node_modules/@storybook/api/dist/esm/index.js] ./node_modules/@storybook/api/dist/esm/index.js + 21 modules 132 KiB {vendors~main} [built]
    | ./node_modules/@storybook/api/dist/esm/index.js 18.3 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/context.js 249 bytes [built]
    | ./node_modules/@storybook/api/dist/esm/store.js 5.5 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/lib/merge.js 795 bytes [built]
    | ./node_modules/@storybook/api/dist/esm/initial-state.js 401 bytes [built]
    | ./node_modules/@storybook/api/dist/esm/lib/stories.js 8.49 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/provider.js 281 bytes [built]
    | ./node_modules/@storybook/api/dist/esm/modules/addons.js 5.95 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/channel.js 1.19 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/notifications.js 2.76 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/settings.js 3.66 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/release-notes.js 3.5 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/refs.js 15.6 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/stories.js 17.4 KiB [built]
    | ./node_modules/@storybook/api/dist/esm/modules/layout.js 7.47 KiB [built]
    |     + 7 hidden modules
[./node_modules/@storybook/core-client/dist/esm/globals/polyfills.js] 97 bytes {vendors~main} [built]
[./node_modules/@storybook/core-client/dist/esm/manager/index.js] ./node_modules/@storybook/core-client/dist/esm/manager/index.js + 78 modules 552 KiB {vendors~main} [built]
    | ./node_modules/@storybook/core-client/dist/esm/manager/index.js 335 bytes [built]
    | ./node_modules/@storybook/ui/dist/esm/index.js 2.96 KiB [built]
    | ./node_modules/@storybook/core-client/dist/esm/manager/provider.js 4.45 KiB [built]
    | ./node_modules/@storybook/core-client/dist/esm/manager/conditional-polyfills.js 762 bytes [built]
    | ./node_modules/react-helmet-async/lib/index.module.js 12 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/spaced/Spaced.js 3.26 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/brand/StorybookLogo.js 4.9 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/Badge/Badge.js 1.63 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/Loader/Loader.js 8.86 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/bar/bar.js 4.96 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/placeholder/placeholder.js 3.81 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/tabs/tabs.js 10.4 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/Zoom/Zoom.js 458 bytes [built]
    | ./node_modules/@storybook/components/dist/esm/brand/StorybookIcon.js 2.87 KiB [built]
    | ./node_modules/@storybook/components/dist/esm/typography/DocumentWrapper.js 6.69 KiB [built]
    |     + 64 hidden modules
[./node_modules/storybook-addon-intl/register.js] 139 bytes {vendors~main} [built]
[./node_modules/storybook-addon-outline/dist/esm/preset/register.js] ./node_modules/storybook-addon-outline/dist/esm/preset/register.js + 2 modules 3.16 KiB {vendors~main} [built]
    | ./node_modules/storybook-addon-outline/dist/esm/preset/register.js 539 bytes [built]
    | ./node_modules/storybook-addon-outline/dist/esm/constants.js 76 bytes [built]
    | ./node_modules/storybook-addon-outline/dist/esm/OutlineSelector.js 2.53 KiB [built]
    + 998 hidden modules
Child HtmlWebpackCompiler:
                          Asset      Size               Chunks  Chunk Names
    __child-HtmlWebpackPlugin_0  6.31 KiB  HtmlWebpackPlugin_0  HtmlWebpackPlugin_0
    Entrypoint HtmlWebpackPlugin_0 = __child-HtmlWebpackPlugin_0
    [./node_modules/html-webpack-plugin/lib/loader.js!./node_modules/@storybook/core-common/dist/cjs/templates/index.ejs] 1.99 KiB {HtmlWebpackPlugin_0} [built]
โ„น ๏ฝขwdm๏ฝฃ: Compiled successfully.
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                   โ”‚
โ”‚   Storybook 6.3.1 started                         โ”‚
โ”‚   6.52 s for manager and 9.64 s for preview       โ”‚
โ”‚                                                   โ”‚
โ”‚    Local:            http://localhost:6006/       โ”‚
โ”‚    On your network:  http://192.168.1.40:6006/    โ”‚
โ”‚                                                   โ”‚
โ”‚   A new version (6.3.2) is available!             โ”‚
โ”‚                                                   โ”‚
โ”‚   Upgrade now: npx sb@latest upgrade              โ”‚
โ”‚                                                   โ”‚
โ”‚   Read full changelog: https://git.io/fhFYe       โ”‚
โ”‚                                                   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
5:43:17 PM [vite] new dependencies found: storybook-addon-intl, updating...
5:43:19 PM [vite] โœจ dependencies updated, reloading page...
5:43:31 PM [vite] new dependencies found: @storybook/addon-actions, updating...
5:43:33 PM [vite] โœจ dependencies updated, reloading page...
5:44:01 PM [vite] page reload src/components/modules/explorer/TableFilters.tsx
package.json summary
{
    "main": "src/index.tsx",
    "packageManager": "[email protected]",
    "dependencies": {
        "react": "^17.0.1",
        "react-dom": "^17.0.1",
        "vite": "^2.3.7",
        "vite-plugin-svgr": "^0.3.0",
        "vite-tsconfig-paths": "^3.3.13",
    },
    "scripts": {
        "storybook": "start-storybook -p 6006",
    },
    "devDependencies": {
        "@mdx-js/react": "^1.6.22",
        "@storybook/addon-actions": "6.3.1",
        "@storybook/addon-docs": "6.3.1",
        "@storybook/addon-essentials": "6.3.1",
        "@storybook/addon-links": "6.3.1",
        "@storybook/addon-postcss": "^2.0.0",
        "@storybook/react": "6.3.1",
        "@vitejs/plugin-react-refresh": "^1.3.1",
        "storybook-addon-intl": "^2.4.1",
        "storybook-builder-vite": "^0.0.10",
        "typescript": "4.1.3",
    }
}

Custom vite plugin not working

I'm trying to install the vite-plugin-react-svg plugin in a react storybook app and it doesn't seem to work.

I've tried adding the plugin both to vite.config.js and to .storybook/main.js's viteFinal and nothing seems to have changed.

Any ideas how could I debug / solve this issue?

Failing to start with Vue

I get this error on running storybook:

Failed to load resource: the server responded with a status of 404 (Not Found)

image

React HMR stuck in reload loop

Thanks for all the great work on this builder so far - really excited to get this implemented into our projects.

I installed the latest version after seeing that React HMR was fixed

Starts up properly but then gets trapped in a reload loop with the following output:

Screenshot 2021-07-07 at 15 48 14

Followed by this output in the browser with Storybook showing a spinner in the component window:

Screenshot 2021-07-07 at 15 51 40

Not sure if anyone else has experience this? Any ideas on what's going on here?

Thanks in advance!

Improvement needed: set up some kind of CI

It would be nice to use GitHub actions to publish to npm, instead of doing all the work (+ version bumps etc) manually.
Maybe replace npm workspaces with something more ergonomical?

Error when using resolver.alias

With

 config.resolve.alias = { 'components': '/src/components' }

Storybook is requesting a file like localhost:8000/src/components/..., but it seems only localhost:8000/@fs/Users/dongchen/path/to/src/components/... (@fs + absolute path) would work. Can you provide an example how to do alias?

build-storybook issue with public static assets

@eirslett @shilman
yarn start-storybook works fine.

however, I ran into error when yarn build-storybook (ex: npx build-storybook -s public -o dist)

example: (using images in the public directory and referenced via absolute paths)

<img
  alt="Hello World"
  class="rounded-full"
  src="/images/200x200.jpg"
/>
โฏ yarn build-storybook
yarn run v1.22.5
$ build-storybook -o storybook-static
info @storybook/vue3 v6.3.0-beta.4
info
info => Cleaning outputDir: C:\GitHub\storybook\storybook-static
info => Loading presets
info => Compiling manager..
vite v2.3.4 building for production...
transforming (1) iframe.html
'vite/dynamic-import-polyfill' is no longer needed if you target modern browsers
โœ“ 137 modules transformed.
[vite]: Rollup failed to resolve import "/images/logo-icon.png" from "src\stories\pages\SideMenu.vue".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`

.storybook/main.js

const path = require("path");

module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-a11y",
    "@storybook/addon-links",
    "@storybook/addon-essentials",
  ],
  core: {
    builder: "storybook-builder-vite",
  },
  async viteFinal(config, { configType }) {
    config.resolve.alias["@"] = path.resolve(__dirname, "../src/");

    return config;
  },
};

Incompatible with vite-plugin-pages

Without the plugin in main.js, vite will throw error can not import virtual:generated-pages, though when I do add the plugin, every request will be redirected to /virtual:xxx. which wouldn't work since it doesn't exist.

config.build.target isn't working

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?

Vite builder sorting stories alphabetically instead of by export order

Describe the bug

It doesn't seem like stories are sorted in the same way as the non-vite builders. Previously it looked like stories were sorted by the order they were exported, so if Default was exported first, it'd show first in the sidebar and in the docs page. This doesn't seem to be the case with the new Vite builder, if I create Default and Custom, even if Custom comes after Default in the order of exports, Custom will show first. Overriding the sortOrder in the preview.js file doesn't seem to fix it either.

Working Example

(This could probably be replicated with other setups too)

  • Create a nextjs app with npx create-next-app
  • Add storybook with npx sb init
  • Modify 1-Button.stories.js to have the following stories:
export const Default = () => <Button>Test</Button>
export const Custom = () => <Button>Test</Button>
  • Open storybook
  • Sidebar and canvas/docs (if you add and configure the docs addon) both show the order of [Default, Custom]

Failing Example (https://github.com/Rixcy/storybook-vite-repro)

  • Create a vite app with yarn create @vitejs/app
  • Add storybook with the vite loader using npx sb@next init --builder storybook-builder-vite
  • Modify Button.stories.tsx to have the following stories:
export const Default = Template.bind({})
export const Custom = Template.bind({})
  • Open storybook
  • Sidebar and canvas/docs show an order of [Custom, Default]
    (Expected result: [Default, Custom])

System

  System:
    OS: macOS 11.4
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
  Browsers:
    Chrome: 91.0.4472.106
    Firefox: 88.0.1
    Safari: 14.1.1
  npmPackages:    @storybook/addon-actions: ^6.3.0-rc.11 => 6.3.0-rc.11 
    @storybook/addon-essentials: ^6.3.0-rc.11 => 6.3.0-rc.11 
    @storybook/addon-links: ^6.3.0-rc.11 => 6.3.0-rc.11 
    @storybook/react: ^6.3.0-rc.11 => 6.3.0-rc.11 

Errors when changing story in docs view

I noticed that when I am in docs view, and I change from one story to another, in the same group, instead of scrolling down to the story, I get a blank page and errors:

Uncaught Error: ThemeWrapper(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
.
.
.
The above error occurred in the <ThemeWrapper> component:

    at ThemeWrapper (http://localhost:6006/.storybook/preview.tsx:34:3)
    at InlineStory (http://localhost:6006/node_modules/@storybook/components/dist/esm/blocks/Story.js?v=409bec44:28:22)
    at Story (http://localhost:6006/node_modules/@storybook/components/dist/esm/blocks/Story.js?v=409bec44:71:24)
    at MDXProvider2 (http://localhost:6006/node_modules/.cache/vite/chunk-GJVQF3U5.js?v=409bec44:119:46)

Then, if I click on another story, again in the same group, the docs will come back, and I will be scrolled to the story.

Install @vitejs/plugin-vue to handle .vue files.

Hello @eirslett

I had the same issue as #4 and thanks to your recommendation it worked (changing the @storybook/vue3 version to 6.3.0-alpha.10) but I'm facing a new issue with Vue3 components.

Here is the complete error log :

 [vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
  Plugin: vite:import-analysis
  File: /Users/thz/Documents/pro/Senz/senz-app/design/src/stories/Header.vue
  17 |                fill="#91BAF8"
  18 |              />
  19 |            </g>
     |                ^
  20 |          </svg>
  21 |          <h1>Acme</h1>
      at formatError (/Users/thz/Documents/pro/Senz/senz-app/design/node_modules/vite/dist/node/chunks/dep-66eb515d.js:43518:46)
      at TransformContext.error (/Users/thz/Documents/pro/Senz/senz-app/design/node_modules/vite/dist/node/chunks/dep-66eb515d.js:43514:19)
      at TransformContext.transform (/Users/thz/Documents/pro/Senz/senz-app/design/node_modules/vite/dist/node/chunks/dep-66eb515d.js:45028:22)
      at async Object.transform (/Users/thz/Documents/pro/Senz/senz-app/design/node_modules/vite/dist/node/chunks/dep-66eb515d.js:43716:30)
      at async transformRequest (/Users/thz/Documents/pro/Senz/senz-app/design/node_modules/vite/dist/node/chunks/dep-66eb515d.js:59433:29)
      at async /Users/thz/Documents/pro/Senz/senz-app/design/node_modules/vite/dist/node/chunks/dep-66eb515d.js:59555:32

package.json

{
  "name": "package",
  "files": [
    "dist"
  ],
  "version": "0.0.0",
  "scripts": {
    "dev": "vite",
    "build": "vue-tsc --noEmit && vite build",
    "serve": "vite preview",
    "storybook": "start-storybook -p 6006",
    "build-storybook": "build-storybook"
  },
  "dependencies": {
    "vue": "^3.0.5"
  },
  "devDependencies": {
    "@babel/core": "^7.13.15",
    "@storybook/addon-actions": "^6.2.8",
    "@storybook/addon-essentials": "^6.2.8",
    "@storybook/addon-links": "^6.2.8",
    "@storybook/builder-webpack5": "^6.3.0-alpha.12",
    "@storybook/vue3": "6.3.0-alpha.10",
    "@types/node": "^14.14.41",
    "@vitejs/plugin-vue": "^1.2.1",
    "@vue/compiler-sfc": "^3.0.5",
    "babel-loader": "^8.2.2",
    "sass": "^1.32.8",
    "sass-loader": "^11.0.1",
    "storybook-builder-vite": "^0.0.3",
    "typescript": "^4.1.3",
    "vite": "^2.1.5",
    "vue-loader": "^16.2.0",
    "vue-tsc": "^0.0.24"
  }
}

Do you have any ideas why @vitejs/plugin-vue is not detected please ^^' ?

Help wanted: Svelte example seems not working

It seems like that the svelte example is not working. Here are the steps to reproduce the error.
Can you verify this behaviour?

Install vite with svelte tempalte

npm init @vitejs/app example-svelte-vite-and-storybook -- --template svelte

Install dependencies

npm install

Install storybook with next dist-tag

npx sb@next init --builder storybook-builder-vite

Run storybook dev server

npm run storybook

Error Message

Unexpected default export without title: undefined

node_modules/@storybook/core-client/dist/esm/preview/loadCsf.js/loadStories2/</<@http://localhost:6006/@fs/Users/andre/src/github/dev/yetanotherblog/example-svelte-vite-and-storybook/node_modules/storybook-builder-vite/node_modules/.vite/chunk-7UV63S5J.js?v=7d8abd40:985:19
node_modules/@storybook/core-client/dist/esm/preview/loadCsf.js/loadStories2/<@http://localhost:6006/@fs/Users/andre/src/github/dev/yetanotherblog/example-svelte-vite-and-storybook/node_modules/storybook-builder-vite/node_modules/.vite/chunk-7UV63S5J.js?v=7d8abd40:980:15
node_modules/@storybook/client-api/dist/esm/config_api.js/ConfigApi2/this.configure@http://localhost:6006/@fs/Users/andre/src/github/dev/yetanotherblog/example-svelte-vite-and-storybook/node_modules/storybook-builder-vite/node_modules/.vite/chunk-WMD4FMNA.js?v=7d8abd40:3455:11
node_modules/@storybook/core-client/dist/esm/preview/loadCsf.js/loadCsf2/<@http://localhost:6006/@fs/Users/andre/src/github/dev/yetanotherblog/example-svelte-vite-and-storybook/node_modules/storybook-builder-vite/node_modules/.vite/chunk-7UV63S5J.js?v=7d8abd40:1079:19
configure2@http://localhost:6006/@fs/Users/andre/src/github/dev/yetanotherblog/example-svelte-vite-and-storybook/node_modules/storybook-builder-vite/node_modules/.vite/@storybook_svelte.js?v=7d8abd40:235:10
@http://localhost:6006/virtual:/@storybook/builder-vite/vite-app.js:65:14

Do you have any pointers for me regarding this error? Or maybe I'm just holding it wrong ๐Ÿคทโ€โ™‚๏ธ

Thank you so much for building this! Can't wait to finally use it with Svelte ๐Ÿงก

Support for monorepos

Firstly excellent library vite and esbuild has been a blessing to improve load dev performance.

I was trying to see if it was possible to use this plugin in a monorepo environment (eg npm7 worksapces or yarn).

From what I understand traditionally in webpack 4 the storybook config goes to the root of the project and then a wildcard resolve is provided - I found this great blog describing this - https://kamranicus.com/using-storybook-in-a-monorepo/

I guess its also not a big deal to just run storybook within a package within the monorepo rather than the root of the project.

MDX/addon-docs bug: Cannot use <Story>

Steps to reproduce: Tweak the example-react project, add

import { Meta, Canvas, Story } from '@storybook/addon-docs';

to Introduction.stories.mdx, and then

 # Welcome to Storybook

<Canvas>
    <Story name="testStory">
        <div>Oh no it doesn't work</div>
    </Story>
</Canvas>

We get:

@storybook_addon-docs.js?v=f78cd456:10690 Uncaught TypeError: Cannot read property 'fromId' of undefined
    at getStoryProps2 (@storybook_addon-docs.js?v=f78cd456:10690)

The error comes from addon-docs/blocks/Story.tsx (the Story component), inside getStoryProps where storyStore for some reason is undefined.

Not working on Windows(OS)

the issue was mentioned on discord, but i'll rewrite it here so that other can see it, it's not working on Windows(OS), the imports path are wrong, hope it could be fixed soon ^^

[vite] Internal server error: Failed to resolve import "/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/.storybook/preview.js" from "..\..\..\..\..\..\virtual:\@storybook\builder-vite\vite-app.js". Does the file exist?
  Plugin: vite:import-analysis
  File: /virtual:/@storybook/builder-vite/vite-app.js
  8  |      import { addDecorator, addParameters, addLoader, addArgTypesEnhancer } from '@storybook/client-api';
  9  |      import { logger } from '@storybook/client-logger';
  10 |      import * as config_0 from '/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/.storybook/preview.js'
     |                                 ^
  11 |  import * as config_1 from '/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js'
  12 |  import * as config_2 from '/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/node_modules/@storybook/addon-docs/dist/esm/frameworks/vue3/config.js'
      at formatError (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:43549:46)
      at TransformContext.error (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:43545:19)
      at normalizeUrl (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:45157:26)
      at async TransformContext.transform (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:45285:57)
      at async Object.transform (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:43747:30)
      at async transformRequest (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:59401:29)
      at async C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:59538:32
15:18:05 [vite] Internal server error: Failed to resolve import "/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/.storybook/preview.js" from "..\..\..\..\..\..\virtual:\@storybook\builder-vite\vite-app.js". Does the file exist?
  Plugin: vite:import-analysis
  File: /virtual:/@storybook/builder-vite/vite-app.js
  8  |      import { addDecorator, addParameters, addLoader, addArgTypesEnhancer } from '@storybook/client-api';
  9  |      import { logger } from '@storybook/client-logger';
  10 |      import * as config_0 from '/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/.storybook/preview.js'
     |                                 ^
  11 |  import * as config_1 from '/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js'
  12 |  import * as config_2 from '/@fsC:/Users/UserName/Desktop/projects/javascript/test-storybook/node_modules/@storybook/addon-docs/dist/esm/frameworks/vue3/config.js'
      at formatError (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:43549:46)
      at TransformContext.error (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:43545:19)
      at normalizeUrl (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:45157:26)
      at async TransformContext.transform (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:45285:57)
      at async Object.transform (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:43747:30)
      at async transformRequest (C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:59401:29)
      at async C:\Users\UserName\Desktop\projects\javascript\test-storybook\node_modules\vite\dist\node\chunks\dep-5c642f9e.js:59538:32 (x2)

Support for Vue2?

Does storybook-builder-vite support component libraries built with Vue 2 as opposed to Vue 3?

In Vite itself, a separate Vue2 plugin needs to be used: https://github.com/underfin/vite-plugin-vue2. It looks like the code here is relying on @vite/plugin-vue (which only supports Vue3). Is there a way to override this for Vue2 libraries?

Builder breaks with package managers that don't hoist (e.g. pnpm)

I recently tried to upgrade from version 0.0.8 to 0.0.10 on my repo, which is using pnpm as its package manager.

pnpm does not hoist dependencies (so, for example, storybook's dependencies are not available in the project's top level node_modules).

When starting a project with storybook-builder-vite and pnpm, we see this error: Error: Failed to resolve force included dependency: airbnb-js-shims, which is one of the forced optimized dependencies here: https://github.com/eirslett/storybook-builder-vite/blob/main/packages/storybook-builder-vite/optimizeDeps.js

I'm confused because:

  • this used to work in 0.0.8 and airbnb-js-shims was in that list there
  • require.resolve("airbnb-js-shims") shouldn't work from this file in pnpm, based on my understanding of node module resolution and pnpm. It is resolving, so something is wrong with my understanding

Manually installing airbnb-js-shims fixes this error, but it is replaced with the next one down the list.

Reproduction here: https://github.com/Pinpickle/storybook-builder-vite-0.0.10-pnpm-bug (you can run it under pnpm and yarn to see it breaking and working)

`app.use`

I would normally register Vue Router or i18n in Vue3 with app.use e.g.

app.use(i18n)

But I don't see how to get hold of it here.

Is there any example or any tip on this?

Thanks in advance

Uncaught Error: Singleton client API not yet initialized, cannot call addParameters

I have managed to get storybook running with start-storybook. I have also now managed to get the build compete.
But when I open the generated SB page I get the following error:

iframe.778fe525.js:33 Uncaught Error: Singleton client API not yet initialized, cannot call addParameters
    at addParameters (iframe.778fe525.js:33)
    at iframe.778fe525.js:90
    at Array.forEach (<anonymous>)
    at iframe.778fe525.js:90
    at Array.forEach (<anonymous>)
    at iframe.778fe525.js:90

Has anyone seen something similar perhaps?

I am using vue3 on windows.

Accessing non-existent addons channel

Hi, I'm just switching over to vite, and trying out this builder, and while it seems to build correctly in the terminal, when storybook opens I see an error in the console, and the page does not finish loading:

Uncaught Error: Accessing non-existent addons channel, see https://storybook.js.org/basics/faq/#why-is-there-no-addons-channel
    at AddonStore2.getChannel (:6006/@fs/Users//.../node_modules/storybook-builder-vite/node_modules/.vite/chunk-LAF5HDGZ.js?v=485b51f5:365)
    at :6006/@fs/Users/.../.storybook/preview.js:18

I am using storybook-dark-mode, and listening to events from that addon using their instructions like: https://github.com/hipstersmoothie/storybook-dark-mode#events. This worked fine with the default storybook webpack builder.

Edit: when I remove that addon, I get a similar error from addon-a11y.

I am using storybook 6.3.0-beta.2

MDX transformation fails

Running the code in the readme and then building the static version does not work out of the box.

Does output "unexpected" large output as well.

Skjermbilde 2021-04-28 kl  19 16 42

vs without the mdx file:

Skjermbilde 2021-04-28 kl  19 19 11

Can't build the example with React

Reproduction:

  1. Clone this repo: git clone https://github.com/eirslett/storybook-builder-vite.git
  2. Go to the React example folder: cd storybook-builder-vite/packages/example-react
  3. Install packages: npm i
  4. Try to build the storybook app: npm run build-storybook ๐Ÿ’ฅ๐Ÿ›

Logs:

๐Ÿš€ npm run build-storybook

> example-react@0.0.7 build-storybook D:\Software\Github\storybook-builder-vite\packages\example-react
> build-storybook

info @storybook/react v6.3.0-rc.10
info
info => Cleaning outputDir: D:\Software\Github\storybook-builder-vite\packages\example-react\storybook-static
info => Loading presets
ERR! Addon value should end in /register OR it should be a valid preset https://storybook.js.org/docs/react/addons/writing-presets/
ERR! @storybook/addon-links
vite v2.3.7 building for production...
transforming (1154) node_modules\@popperjs\core\lib\dom-utils\isTableElement.jsConflicting namespaces: "node_modules\@storybook\client-api\dist\esm\index.js" re-exports "combineParameters" from both "node_modules\@storybook\client-api\dist\esm\index.js" and "node_modules\@storybook\client-api\dist\esm\parameters.js" (will be ignored)
Conflicting namespaces: "node_modules\@storybook\components\dist\esm\index.js" re-exports "components" from both "node_modules\@storybook\components\dist\esm\index.js" and "node_modules\@storybook\components\dist\esm\typography\DocumentFormatting.js" (will be ignored)
Conflicting namespaces: "node_modules\@storybook\addon-docs\dist\esm\blocks\index.js" re-exports "SourceState" from both "node_modules\@storybook\addon-docs\dist\esm\blocks\Canvas.js" and "node_modules\@storybook\addon-docs\dist\esm\blocks\Source.js" (will be ignored)
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
Use of eval is strongly discouraged, as it poses security risks and may cause issues with minification
โœ“ 1180 modules transformed.
rendering chunks (7)...[vite:build-html] The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../../../../../../iframe.html".
ERR! Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../../../../../../iframe.html".
ERR!     at error (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:164:30)
ERR!     at FileEmitter.emitFile (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:12942:24)
ERR!     at Object.generateBundle (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:24622:22)
ERR!     at async Bundle.generate (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:13388:9)
ERR!     at async handleGenerateWrite (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:20791:23)
ERR!     at async doBuild (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:45406:20)
ERR!     at async build (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:45230:16)
ERR!     at async build (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\storybook-builder-vite\build.js:27:5)
ERR!     at async Promise.all (index 1)
ERR!     at async buildStaticStandalone (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\@storybook\core-server\dist\cjs\build-static.js:141:28)
ERR!     at async buildStatic (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\@storybook\core-server\dist\cjs\build-static.js:161:5)
ERR!  Error: The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths, received "../../../../../../iframe.html".
ERR!     at error (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:164:30)
ERR!     at FileEmitter.emitFile (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:12942:24)
ERR!     at Object.generateBundle (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:24622:22)
ERR!     at async Bundle.generate (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:13388:9)
ERR!     at async handleGenerateWrite (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\rollup\dist\shared\rollup.js:20791:23)
ERR!     at async doBuild (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:45406:20)
ERR!     at async build (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\vite\dist\node\chunks\dep-bc228bbb.js:45230:16)
ERR!     at async build (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\storybook-builder-vite\build.js:27:5)
ERR!     at async Promise.all (index 1)
ERR!     at async buildStaticStandalone (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\@storybook\core-server\dist\cjs\build-static.js:141:28)
ERR!     at async buildStatic (D:\Software\Github\storybook-builder-vite\packages\example-react\node_modules\@storybook\core-server\dist\cjs\build-static.js:161:5) {
ERR!   code: 'PLUGIN_ERROR',
ERR!   pluginCode: 'VALIDATION_ERROR',
ERR!   plugin: 'vite:build-html',
ERR!   hook: 'generateBundle'
ERR! }

System Info:

  System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 4.82 GB / 15.87 GB
  Binaries:
    Node: 12.22.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 6.14.12 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.964.0), Chromium (91.0.864.41)
    Internet Explorer: 11.0.19041.1
  npmPackages:
    vite: ^2.3.7 => 2.3.7

Error: Cannot find module '@storybook/builder-storybook-builder-vite'

Hi @eirslett, when running my Storybook locally, in dev mode, I get the error below:

I can confirm that I have installed your package and updated my config in main.js. The only two differences with my project and your example, is that mine uses Typescript and environment variables in some places. Typescript was working fine before, but the env vars are new (I use import.meta.env like the Vite docs specify), which is the reason for trying this plugin.

Let me know if you want me to try something or have any questions.

$ start-storybook -p 6006 -s public
info @storybook/react v6.2.8
info
ERR! Error: Cannot find module '@storybook/builder-storybook-builder-vite'
ERR! Require stack:
ERR! - /Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js
ERR! - /Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-static.js
ERR! - /Users/my/project/node_modules/@storybook/core-server/dist/cjs/index.js
ERR! - /Users/my/project/node_modules/@storybook/core/dist/cjs/server.js
ERR! - /Users/my/project/node_modules/@storybook/core/server.js
ERR! - /Users/my/project/node_modules/@storybook/react/dist/cjs/server/index.js
ERR! - /Users/my/project/node_modules/@storybook/react/bin/index.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19)
ERR!     at require (internal/modules/cjs/helpers.js:88:18)
ERR!     at /Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js:34:36
ERR!     at processTicksAndRejections (internal/process/task_queues.js:93:5)
ERR!     at async getPreviewBuilder (/Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js:33:24)
ERR!     at async buildDevStandalone (/Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:97:24)
ERR!     at async buildDev (/Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:147:5)
ERR!  Error: Cannot find module '@storybook/builder-storybook-builder-vite'
ERR! Require stack:
ERR! - /Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js
ERR! - /Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-static.js
ERR! - /Users/my/project/node_modules/@storybook/core-server/dist/cjs/index.js
ERR! - /Users/my/project/node_modules/@storybook/core/dist/cjs/server.js
ERR! - /Users/my/project/node_modules/@storybook/core/server.js
ERR! - /Users/my/project/node_modules/@storybook/react/dist/cjs/server/index.js
ERR! - /Users/my/project/node_modules/@storybook/react/bin/index.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:725:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:952:19)
ERR!     at require (internal/modules/cjs/helpers.js:88:18)
ERR!     at /Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js:34:36
ERR!     at processTicksAndRejections (internal/process/task_queues.js:93:5)
ERR!     at async getPreviewBuilder (/Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js:33:24)
ERR!     at async buildDevStandalone (/Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:97:24)
ERR!     at async buildDev (/Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-dev.js:147:5) {
ERR!   code: 'MODULE_NOT_FOUND',
ERR!   requireStack: [
ERR!     '/Users/my/project/node_modules/@storybook/core-server/dist/cjs/utils/get-preview-builder.js',
ERR!     '/Users/my/project/node_modules/@storybook/core-server/dist/cjs/build-static.js',
ERR!     '/Users/my/project/node_modules/@storybook/core-server/dist/cjs/index.js',
ERR!     '/Users/my/project/node_modules/@storybook/core/dist/cjs/server.js',
ERR!     '/Users/my/project/node_modules/@storybook/core/server.js',
ERR!     '/Users/my/project/node_modules/@storybook/react/dist/cjs/server/index.js',
ERR!     '/Users/my/project/node_modules/@storybook/react/bin/index.js'
ERR!   ]
ERR! }

WARN Broken build, fix the error above.
WARN You may need to refresh the browser.

error Command failed with exit code 1.

Thanks in advance

More maintainers needed

This project needs more maintainers. Are you willing to contribute? Please reply on this issue, or send me a message directly.

Builder fails on non-React projects that require SFC transpilation

Succeeds:

  • React
  • React-ts
  • Lit-Element

Fails:

  • Vue
  • Svelte

See repro steps & errors below

Vue

npm init @vitejs/app vite-vue-app --template vue && cd vite-vue-app && npm install
npx sb@next init --builder storybook-builder-vite && npm run storybook

=> ERROR

[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. Install @vitejs/plugin-vue to handle .vue files.
  Plugin: vite:import-analysis
  File: /Users/shilman/projects/testing/vite-vue-app/src/stories/Header.vue
  17 |                fill="#91BAF8"
  18 |              />
  19 |            </g>
     |                ^
  20 |          </svg>
  21 |          <h1>Acme</h1>

Svelte

npm init @vitejs/app vite-svelte-app --template svelte && cd vite-svelte-app && npm install
npx sb@next init --builder storybook-builder-vite && npm run storybook

=> ERROR

[vite] Internal server error: Failed to parse source for import analysis because the content contains invalid JS syntax. You may need to install appropriate plugins to handle the .svelte file format.
  Plugin: vite:import-analysis
  File: /Users/shilman/projects/testing/vite-svelte-app/node_modules/@storybook/svelte/dist/esm/client/preview/PreviewRender.svelte
  29 |      });
  30 |    }
  31 |  </script>

If import module in stories with custom resolve alias its throw an error

Describe the bug
Vite builder doesn't read vite.config.ts. Custom resolve alias defined in vite.config.ts.
If import module in stories with custom resolve alias its throw an error.
E.g. : import HelloWorld from "@/components/HelloWorld.vue"

12:23:48 AM [vite] Internal server error: Failed to resolve import "@/components/HelloWorld.vue" from "src/stories/HelloWorld.stories.js". Does the file exist?
  Plugin: vite:import-analysis
  File: /mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/src/stories/HelloWorld.stories.js
  1  |  import HelloWorld from "@/components/HelloWorld.vue";
     |                          ^
  2  |  
  3  |  export default {
      at formatError (/mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:43549:46)
      at TransformContext.error (/mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:43545:19)
      at normalizeUrl (/mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:45157:26)
      at async TransformContext.transform (/mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:45285:57)
      at async Object.transform (/mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:43747:30)
      at async transformRequest (/mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:59401:29)
      at async /mnt/d/Programming/NodeJS/repro/storybook-vite-builder-custom-resolver-alias/node_modules/vite/dist/node/chunks/dep-5c642f9e.js:59538:32

Repro Repo
Github Repo

Expected behavior
Vite builder should be resolve custom alias without error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.