将react-toolbox整合到故事书中

时间:2017-05-10 09:39:34

标签: reactjs postcss react-toolbox cssnext postcss-import

我遇到了在故事书中创建简单的react-toolbox按钮故事的问题。我想强调的是,我在应用程序中的所有react-toolbox设置都运行良好。适当的postcss.config.js文件如下所示:

const theme = require('./src/theme');

module.exports = {
  plugins: {
    'postcss-import': {
      root: __dirname
    },
   'postcss-mixins': {},
   'postcss-each': {},
   'postcss-cssnext': {
      browsers: ['last 2 versions', '> 5%'],
      features: {
        customProperties: {
          variables: theme
        }
      }
    }
  }
};

我收到了这个错误,我不确定我的配置中缺少哪个加载程序。

ERROR in ./~/react-toolbox/lib/button/theme.css
Module parse failed: /Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/react-toolbox/lib/button/theme.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:0)
    at Parser.pp$4.raise (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:603:10)
    at Parser.pp$3.parseExprAtom (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1822:12)
    at Parser.pp$3.parseExprSubscripts (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1715:21)
    at Parser.pp$3.parseMaybeUnary (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1597:21)
    at Parser.pp$3.parseExpression (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1573:21)
    at Parser.pp$1.parseStatement (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:727:47)
 @ ./~/react-toolbox/lib/button/index.js 24:13-35
ERROR in ./~/react-toolbox/lib/ripple/theme.css
Module parse failed: /Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/react-toolbox/lib/ripple/theme.css Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1:0)
    at Parser.pp$4.raise (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:2221:15)
    at Parser.pp.unexpected (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:603:10)
    at Parser.pp$3.parseExprAtom (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1822:12)
    at Parser.pp$3.parseExprSubscripts (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1715:21)
    at Parser.pp$3.parseMaybeUnary (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1692:19)
    at Parser.pp$3.parseExprOps (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1637:21)
    at Parser.pp$3.parseMaybeConditional (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1620:21)
    at Parser.pp$3.parseMaybeAssign (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1597:21)
    at Parser.pp$3.parseExpression (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:1573:21)
    at Parser.pp$1.parseStatement (/Users/kuko/Workspace/in2core/qtakecloud-frontend/node_modules/@kadira/storybook/node_modules/acorn/dist/acorn.js:727:47)
 @ ./~/react-toolbox/lib/ripple/index.js 13:13-35

看起来@import存在问题,但为什么一切都在我的应用中正常运行?在这里有人可以帮助我解决这个问题吗?

感谢您的任何建议。

0 个答案:

没有答案