webpack手动配置React开发环境的步骤(2)

// webpack.config.js module.exports = { ... module: { rules: [{ test: /\.scss$/, use: [ "style-loader", // creates style nodes from JS strings "css-loader", // translates CSS into CommonJS "sass-loader" // compiles Sass to CSS ] }] } };

在src内新增index.scss

$designWidth: 750; @function px2rem($px) { @return $px*10/$designWidth + rem; } #root { div { font-size: px2rem(500); display: flex; color: #64B587; input { flex: 1 1 auto; } span { flex: 1 1 auto; text-align: center; } } }

在index.js中新增import index.scss

最终效果:

webpack手动配置React开发环境的步骤

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/ac14183a70faebc831c480059f0f35f5.html