Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept resolve alias in custom webpack config #44

Closed
ivivona opened this issue Apr 4, 2016 · 5 comments
Closed

Accept resolve alias in custom webpack config #44

ivivona opened this issue Apr 4, 2016 · 5 comments

Comments

@ivivona
Copy link

ivivona commented Apr 4, 2016

React native web project requires aliasing it to react-native to keep it like React native.

@arunoda
Copy link
Member

arunoda commented Apr 6, 2016

Now we've enabled this. Use version 1.5.0.
See: #64 for more information.

@arunoda arunoda closed this as completed Apr 6, 2016
@hliyan
Copy link

hliyan commented May 30, 2016

@arunoda ,
I'm having some trouble resolving an alias. storybook version: 1.28.1

./storybook/webpack.config.js resolve block:

  resolve: {
    alias: {
      foo: path.resolve(__dirname, 'bar.js')
    },
    extensions: ['', '.js']
  }

import foo from 'foo'; just doesn't seem to get resolved (undefined). I've verified the file path gets resolved. What am I doing wrong?

@dziamid
Copy link

dziamid commented Sep 19, 2016

@hliyan have you resolved it? I'm having the same problem on linux. It does however work on mac without problems.

@arunoda
Copy link
Member

arunoda commented Sep 19, 2016

@dziamid We had a bug in the latest storybook release. We patched and released a new version. Could you try the latest version (v2.15.1)

ndelangen pushed a commit that referenced this issue Apr 5, 2017
Add title attribute for story list links
ndelangen pushed a commit that referenced this issue Apr 11, 2017
Add border-radius for comment form
thani-sh pushed a commit that referenced this issue May 24, 2017
@notgiorgi
Copy link

notgiorgi commented Sep 26, 2017

I'm using react-native-web and I want to share stories between web and native, so I have 2 separate configurations for storybook but 1 stories folder.

In stories I need to import storiesOf but import it from either @storybook/react or @storybook/react-native

So I put this in react-native storybook webpack config:

const defaultConfig = require('@storybook/react-native/dist/server/config/webpack.config')
  .default

module.exports = Object.assign(defaultConfig, {
  resolve: Object.assign(defaultConfig.resolve || {}, {
    alias: Object.assign(
      (defaultConfig.resolve && defaultConfig.resolve.alias) || {},
      {
        '@storybook/react': '@storybook/react-native',
      },
    ),
  }),
})

and I'm using import { storiesOf } from '@storybook/react' everywhere in stories

But it still outputs the error, Can't find variable: document which means alias is not working

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

No branches or pull requests

5 participants