https://github.com/juanpicado/webpack-react-conf
webpack-react-conf
https://github.com/juanpicado/webpack-react-conf
Last synced: 2 months ago
JSON representation
webpack-react-conf
- Host: GitHub
- URL: https://github.com/juanpicado/webpack-react-conf
- Owner: juanpicado
- License: mit
- Created: 2016-07-13T05:45:06.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-07-31T14:30:28.000Z (almost 9 years ago)
- Last Synced: 2025-03-23T21:42:52.515Z (3 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
## webpack-react-conf
This module helps to reduce the overloaded webpack configuration using **babel and JSX** as a default loader, dependencies management.
npm install webpack-react-conf --save-dev
The configuration contains the following loaders:* scss-loader (.scss) `node-sass required`
* file-loader
* style-loader (css modules)
* postcss-loader
* url-loader (jpg and png)It bundle a file (style.css) with all components that use styles as references.
## Usage
* Create a file in the root folder `webpack.conf.js` and add the following code.
````
const configuration = require('webpack-react-conf');
const webpackConf = configuration(
'./src/index.jsx',
'./build',
'index.min.js',
'myAppFoo',
'umd');
module.exports = webpackConf;
````* Define your React Component at `./src/index.jsx`
`````
import React from 'react';
import ReactDOM from 'react-dom';class HelloWorld extends React.Component {
render() {
returnHello, world!
;
}
}ReactDOM.render(, document.getElementById('app'));
export default HelloWorld;
`````
* Run webpack in the root folder `webpack --config webpack.conf.js`
* See output file on `dist/index.min.js`
* Test your component in a web server#### Options
The module returns a function, it accepts 4 parameters.
1. The entry point file
2. The output name
3. The name of the library
4. The library target#### Examples
[https://github.com/juanpicado/webpack-examples/tree/master/react-bundle](https://github.com/juanpicado/webpack-examples/tree/master/react-bundle)
This module extends [webpack-babel-conf](https://github.com/juanpicado/webpack-babel-conf)