在docz上找不到模块“椭圆”崩溃

时间:2019-02-25 03:03:31

标签: reactjs next.js

我有一些错误:

  1. 如果我导入的组件代码中包含别名路径,则会出错
  2. 使用@ emotion / core的样式不适用....但是如果使用react doc中的内联样式,则可以应用 错误/崩溃:

糟糕,我们坠毁了 找不到模块“椭圆形” 堆栈跟踪.............

此处是我的组件

import React from 'react'
import { css } from '@emotion/core'
import { Background, Color } from 'Utils'
import PropTypes from 'prop-types'

const Badge = ({ color, children, style, ...props }) => {
const badge = css`font-size: 9px; letter-spacing: 1px; color: ${ Color.white }; border-radius: 10px; padding: 2px 7px; vertical-align: middle; display: inline-block; font-weight: bold;`
return (
<div css={ [badge, Background(color), style] } { ...props }>{ children }
)
}

Badge.propTypes = {
color: PropTypes.string,
children: PropTypes.node,
style: PropTypes.string
}

export default Badge

我的doczrc.js配置

`import { alias } from './next.config'

export default {
title: 'Reactism',
description: 'Reactism is a React Boilerplate based next.js',
modifyBundlerConfig: config => {
console.log("alias",alias)
const newConfig = {
...config,
resolve: {
...config.resolve,
alias: {
...config.resolve.alias,
...alias
}
},
module: {
rules: [
...config.module.rules,
{
test: /.css$/,
use: ['css-loader']
}
]
}
}
return newConfig
}
}

**和next.config.js上的别名**

const aliases = { 'Containers': path.resolve(__dirname, 'components/containers'), 'Elements': path.resolve(__dirname, 'components/elements/'), 'Utils': path.resolve(__dirname, 'components/utilities/'), 'Layout': path.resolve(__dirname, 'components/pageLayouts/'), ................... }

任何人都可以帮忙吗?

0 个答案:

没有答案