duan602728596 / antd-schema-form

Based on Ant Design, interactive forms can be generated through JSON Schema configuration. - 基于Ant Design,可以通过JSON Schema配置生成可交互的表单。
https://duan602728596.github.io/antd-schema-form/#/
MIT License
170 stars 28 forks source link

样式加载不出来 #12

Closed hqwuzhaoyi closed 5 years ago

hqwuzhaoyi commented 5 years ago
//这是我的package.json
  "babel": {
    "presets": [
      "react-app",
      "@babel/preset-env"
    ],
    "plugins": [
      [
        "import",
        {
          "libraryName": "antd",
          "libraryDirectory": "es",
          "style": "css"
        }
      ]
    ]
  }
//这里是webconfig.js
 {
              test: /node_modules[\\/]antd-schema-form$/,
              use: [
                {
                  loader: require.resolve('babel-loader'),
                  options: {
                    plugins: [
                      [
                        'import',
                        {
                          libraryName: 'antd',
                          libraryDirectory: 'es',
                          style: 'css'
                        }
                      ]
                    ]
                  }
                }
              ]
            },
duan602728596 commented 5 years ago

/node_modules[\\/]antd-schema-form$/改为/node_modules[\\/]antd-schema-form/,文档写错了我晕...

hqwuzhaoyi commented 5 years ago

@duan602728596 image 这个问题是怎么出现的呢

duan602728596 commented 5 years ago

你怎么配置的js的loader?

hqwuzhaoyi commented 5 years ago

@duan602728596 加的这两条对吗,其他的是enject默认导出后的

module: {
      strictExportPresence: true,
      rules: [

        {
          test: /node_modules[\\/]antd-schema-form/,
          use: [
            {
              loader: 'babel-loader',
              options: {
                plugins: [
                  [
                    'import',
                    {
                      libraryName: 'antd',
                      libraryDirectory: 'es',
                      style: 'css'
                    }
                  ]
                ]
              }
            }
          ]
        },
        {
          test: /\.json$/,
          loader: 'json-loader'
        },
duan602728596 commented 5 years ago

你用的webpack几?webpack3以后就没有必要配置json-loader了

hqwuzhaoyi commented 5 years ago

@duan602728596 用的是4,没有加就会出现上面的错误

duan602728596 commented 5 years ago

我想起来了,/node_modules[\\/]antd-schema-form.*\.jsx?$/

hqwuzhaoyi commented 5 years ago

我还想问个问题,想要栅格布局怎么实现呢😀

duan602728596 commented 5 years ago

没法配置栅格,不过你可以通过覆盖样式来实现

hqwuzhaoyi commented 5 years ago

好的,了解了,谢谢你