Lobos / react-ui

A collection of components for React, base on bootstrap 4.0.
http://lobos.github.io/react-ui/
MIT License
1.63k stars 302 forks source link

es5项目不能用这套ui库么... 个人很喜欢这个ui #100

Closed yclnycl closed 7 years ago

vipcxj commented 7 years ago

js基本向前兼容的吧,这不叫事吧~

yclnycl commented 7 years ago

@vipcxj 额 我现在是这样的 react项目是用es5写的 引入rctui之后报了这样一个错误 SyntaxError: 'import' and 'export' may appear only with 'sourceType: module' 我是一名后端程序员... 对前端不太精通 尤其是编译这一块 麻烦指点我一下好吗

vipcxj commented 7 years ago

我还是java程序员呢,我觉得你改下babel的配置就好~

Lobos commented 7 years ago

可以用这个打包好的版本 ··· // html

// webpack config externals: {'react': 'React', 'react-dom': 'ReactDOM', 'rctui': 'rctui'}, // jsx import { Form } from 'rctui' ...

yclnycl commented 7 years ago

我已经把我的项目从browserify+es5+react迁移到webpack+es6+react了 就是为了用你这个ui库 但是现在有个问题 编译scss的时候会报错

ERROR in ./~/css-loader?modules&localIdentName=[local]-[hash:base64:5]!./~/postcss-loader/lib!./~/sass-loader/lib/loader .js!./~/rctui/styles/_list.scss Module build failed: Error: No PostCSS Config found in: E:\xampp\htdocs\nvwa\node_modules\rctui\styles at E:\xampp\htdocs\nvwa\node_modules\postcss-load-config\index.js:51:26 at @ ./~/rctui/styles/_list.scss 4:14-178

具体是这样的 我已经尝试过 npm rebuild node-sass 但是还有报错 我的webpack.config.js是这样的

var webpack = require('webpack'); module.exports = { entry: { page: "./public/src/app.jsx" }, output: { path: './public/build', filename: "app.js" }, module: { loaders: [ { test: /.jsx?$/, loader: 'babel', query: { presets: ['react', 'es2015'], plugins: ['transform-object-rest-spread', 'react-require'] } }, { test: /.(css|less)$/, loader: 'style-loader!css-loader!postcss-loader!less-loader' }, { test: /.scss$/, loaders: ['style-loader', 'css-loader?modules&localIdentName=[local]-[hash:base64:5]', 'postcss-loader', 'sass-loader'] }, ] } };

希望得到回复 谢谢

Lobos commented 7 years ago

module后面加上 postcss的配置 ··· var autoprefixer = require('autoprefixer') var precss = require('precss')


  module: {
     ...
  },
  postcss: function () {
    return [autoprefixer({ browsers: ['> 1%', 'IE 9'] }), precss]
  }