NPM install-g Create-react-app
Create-react-app Hello-world
NPM start
Export the webpack configuration using npm run eject
modifying webpack.config.dev.js and Webpack.config-prod.js configuration files
Exclude: [/\.html$/, /\. (JS|JSX) $/, /\. (css|less) $/,//knock on the blackboard, draw the key/\.json$/, /\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/,],{test:/\. (css|less) $/,//knock on the blackboard, draw the keyUse : [Require.resolve (' Style-loader '), {loader:require.resolve (' Css-loader '), Options: {importloaders:1,},}, {Loader:require.resolve (' Postcss-loader '), options: {//necessary for external CSS imports to work //https://github.com/facebookincubator/create-react-app/issues/2677Ident: ' Postcss ', Plugins: ()=[Require (' Postcss-flexbugs-fixes '), Autoprefixer ({browsers: [' >1% ', ' Last 4 versions ', ' Firefox ESR ', ' Not IE < 9 ',//React doesn ' t support IE8 anyway], Flexbox:' no-2009 ', }), ], }, }, //knock on the blackboard, draw the key{loader:require.resolve (' Less-loader ')//compiles less to CSS } ],}
Create-react-app Scaffolding Configuration Less