webpack.config env.prod added & build scripts modified

This commit is contained in:
xidedix 2017-08-24 16:34:34 +02:00
parent 2aa3baa6ee
commit 68692ad382
9 changed files with 246 additions and 16720 deletions

View File

@ -1,4 +1,9 @@
## Changelog CoreUI react
## Changelog [react](./REACT.md) version
### 2017.08.24
- webpack.config env.prod
- Dashboard .dropdown-menu-right temp.scss hotfix (full)
- callout.scss .chart-wrapper hotfix (full)
### 2017.08.11
- Bootstrap 4 beta

36
REACT.md Normal file
View File

@ -0,0 +1,36 @@
# React version
## Intro
It uses Sass (with .scss). The style is loaded at the component level.
Dependencies can be handled by **npm**.
## Directories
```
src (js|jsx source)
scss (scss source)
public (html template)
public/img (images)
```
## Usage
**npm i** - to install dependencies
## Sctipts
**npm start** for developing (it runs webpack-dev-server)
**npm run build** to run a dev build
**npm run clean** to clean build dir
**npm run dev** to run a dev build with watching filesystem for changes
## See also
[Changelog](./CHANGELOG.md)
[Readme](./README.md)

File diff suppressed because it is too large Load Diff

View File

@ -9,14 +9,14 @@
"private": true,
"homepage": ".",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"copy-webpack-plugin": "^4.0.1",
"css-hot-loader": "^1.3.0",
"css-loader": "^0.28.4",
"css-loader": "^0.28.5",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-loader": "^0.5.1",
@ -26,29 +26,29 @@
"sass-loader": "^6.0.6",
"source-list-map": "^2.0.0",
"style-loader": "^0.18.2",
"uglify-js": "^3.0.27",
"uglify-js": "^3.0.28",
"url-loader": "^0.5.9",
"webpack": "^3.5.3",
"webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1"
},
"dependencies": {
"bootstrap": "^4.0.0-beta",
"chart.js": "2.6.0",
"font-awesome": "^4.7.0",
"history": "4.6.3",
"history": "4.7.2",
"react": "^15.6.1",
"react-addons-css-transition-group": "^15.6.0",
"react-addons-transition-group": "^15.6.0",
"react-chartjs-2": "2.5.6",
"react-chartjs-2": "2.6.1",
"react-dom": "^15.6.1",
"react-router-dom": "4.1.2",
"react-router-dom": "4.2.0",
"reactstrap": "^4.8.0",
"simple-line-icons": "^2.4.1"
},
"scripts": {
"dev": "webpack -d --progress --watch",
"start": "webpack-dev-server --env.dev --open --hot --progress --colors --inline",
"build": "webpack -p --progress",
"dev": "webpack -d --progress --watch --profile --json > compilation-stats.json --env.dev",
"start": "webpack-dev-server --progress --colors --inline --env.dev",
"build": "webpack -p --progress --env.prod",
"clean": "rimraf ./build"
},
"engines": {

View File

@ -13,7 +13,8 @@ const SRC_DIR = path.resolve(__dirname, 'src');
console.log('BUILD_DIR', BUILD_DIR);
console.log('SRC_DIR', SRC_DIR);
module.exports = {
module.exports = (env = {}) => {
return {
entry: {
index: [SRC_DIR + '/index.js']
},
@ -21,7 +22,8 @@ module.exports = {
path: BUILD_DIR,
filename: '[name].bundle.js'
},
watch: true,
// watch: true,
devtool: env.prod ? 'source-map' : 'cheap-module-eval-source-map',
devServer: {
contentBase: BUILD_DIR,
// port: 9001,
@ -90,7 +92,7 @@ module.exports = {
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.UglifyJsPlugin({sourceMap: true}),
new webpack.NamedModulesPlugin(),
extractCSS,
extractSCSS,
@ -107,4 +109,4 @@ module.exports = {
)
]
}
;
};

View File

@ -1,13 +0,0 @@
## Changelog CoreUI react
### 2017.08.01
- Sidebar component:
- title item with optional wrapper and class (_nav.js)
- nav link item with optional badge
- code refactoring
### 2017.07.31
- moved to [reactstrap](https://reactstrap.github.io/)
- moved to [webpack](https://webpack.js.org/) (dropping gulp)
- data driven Sidebar component (_nav.js)

File diff suppressed because it is too large Load Diff

View File

@ -9,14 +9,14 @@
"private": true,
"homepage": ".",
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.24.1",
"copy-webpack-plugin": "^4.0.1",
"css-hot-loader": "^1.3.0",
"css-loader": "^0.28.4",
"css-loader": "^0.28.5",
"extract-text-webpack-plugin": "^3.0.0",
"file-loader": "^0.11.2",
"html-loader": "^0.5.1",
@ -26,29 +26,29 @@
"sass-loader": "^6.0.6",
"source-list-map": "^2.0.0",
"style-loader": "^0.18.2",
"uglify-js": "^3.0.27",
"uglify-js": "^3.0.28",
"url-loader": "^0.5.9",
"webpack": "^3.5.3",
"webpack": "^3.5.5",
"webpack-dev-server": "^2.7.1"
},
"dependencies": {
"bootstrap": "^4.0.0-beta",
"chart.js": "2.6.0",
"font-awesome": "^4.7.0",
"history": "4.6.3",
"history": "4.7.2",
"react": "^15.6.1",
"react-addons-css-transition-group": "^15.6.0",
"react-addons-transition-group": "^15.6.0",
"react-chartjs-2": "2.5.6",
"react-chartjs-2": "2.6.1",
"react-dom": "^15.6.1",
"react-router-dom": "4.1.2",
"react-router-dom": "4.2.0",
"reactstrap": "^4.8.0",
"simple-line-icons": "^2.4.1"
},
"scripts": {
"dev": "webpack -d --progress --watch",
"start": "webpack-dev-server --env.dev --open --hot --progress --colors --inline",
"build": "webpack -p --progress",
"dev": "webpack -d --progress --watch --profile --json > compilation-stats.json --env.dev",
"start": "webpack-dev-server --progress --colors --inline --env.dev",
"build": "webpack -p --progress --env.prod",
"clean": "rimraf ./build"
},
"engines": {

View File

@ -13,7 +13,8 @@ const SRC_DIR = path.resolve(__dirname, 'src');
console.log('BUILD_DIR', BUILD_DIR);
console.log('SRC_DIR', SRC_DIR);
module.exports = {
module.exports = (env = {}) => {
return {
entry: {
index: [SRC_DIR + '/index.js']
},
@ -21,7 +22,8 @@ module.exports = {
path: BUILD_DIR,
filename: '[name].bundle.js'
},
watch: true,
// watch: true,
devtool: env.prod ? 'source-map' : 'cheap-module-eval-source-map',
devServer: {
contentBase: BUILD_DIR,
// port: 9001,
@ -90,7 +92,7 @@ module.exports = {
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new webpack.optimize.UglifyJsPlugin({sourceMap: true}),
new webpack.NamedModulesPlugin(),
extractCSS,
extractSCSS,
@ -107,4 +109,4 @@ module.exports = {
)
]
}
;
};