Last active
December 4, 2017 09:32
-
-
Save mytharcher/89891ce55f6b98930c57351bbf3a23af to your computer and use it in GitHub Desktop.
Really simple and useful practice for React project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"dev": "webpack-dev-server --port 3000 --hot --inline --history-api-fallback --colors --progress", | |
"build": "NODE_ENV=production webpack -p --optimize-occurence-order --optimize-dedupe --output-public-path 'http://cdn.domain.com/assets/[hash]/'", | |
"release": "npm run build && bin/deploy" | |
}, | |
"dependencies": { | |
"axios": "0.12.0", | |
"classnames": "2.2.5", | |
"qrcode.react": "0.6.1", | |
"react": "15.2.0", | |
"react-dom": "15.2.0", | |
"react-markdown": "2.4.2", | |
"react-redux": "4.4.5", | |
"react-router": "2.5.2", | |
"react-router-redux": "4.0.5", | |
"redux": "3.5.2", | |
"socket.io": "1.3.x", | |
"uuid": "3.0.0" | |
}, | |
"devDependencies": { | |
"autoprefixer": "6.3.7", | |
"babel-core": "6.10.4", | |
"babel-loader": "6.2.4", | |
"babel-preset-es2015": "6.9.0", | |
"babel-preset-react": "6.11.1", | |
"babel-preset-react-hmre": "1.1.1", | |
"css-loader": "0.23.1", | |
"dotenv": "^2.0", | |
"eslint": "2.13.1", | |
"eslint-config-airbnb": "9.0.1", | |
"eslint-loader": "1.4.0", | |
"eslint-plugin-import": "1.10.2", | |
"eslint-plugin-jsx-a11y": "1.5.3", | |
"eslint-plugin-react": "5.2.2", | |
"file-loader": "0.9.0", | |
"html-webpack-plugin": "2.22.0", | |
"json-loader": "0.5.4", | |
"less": "2.7.1", | |
"less-loader": "2.2.3", | |
"postcss-loader": "0.9.1", | |
"redux-catch": "1.1.1", | |
"redux-devtools": "3.3.1", | |
"redux-logger": "2.6.1", | |
"style-loader": "0.13.1", | |
"url-loader": "0.5.7", | |
"webpack": "1.13.3", | |
"webpack-dev-server": "1.16.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const autoprefixer = require('autoprefixer'); | |
const HtmlwebpackPlugin = require('html-webpack-plugin'); | |
require('dotenv').load(); | |
module.exports = { | |
entry: './src/', | |
output: { | |
path: './dist/[hash]', | |
filename: '[name].js' | |
}, | |
resolve: { | |
extensions: ['', '.js', '.jsx'] | |
}, | |
eslint: { | |
configFile: './.eslintrc' | |
}, | |
module: { | |
preLoaders: [ | |
{ | |
test: /\.jsx?$/, | |
loader: 'eslint-loader', | |
include: /src/, | |
exclude: /node_modules/ | |
} | |
], | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
loader: 'babel', | |
query: { | |
presets: ['es2015', 'react'] | |
}, | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.json$/, | |
loader: 'json-loader' | |
}, | |
{ | |
test: /\.less$/, | |
loaders: ['style', 'css', 'less', 'postcss'] | |
}, | |
{ | |
test: /\.css$/, | |
loaders: ['style', 'css'] | |
}, | |
{ | |
test: /\.(jpe?g|gif|png|svg|eot|woff|ttf|otf)$/, | |
loader: 'url', | |
query: { | |
limit: 4096, | |
name: '[name].[ext]' | |
} | |
} | |
] | |
}, | |
postcss: [autoprefixer], | |
devServer: { | |
proxy: { | |
'/assets/*': { | |
target: process.env.API_BASE_URL, | |
changeOrigin: true | |
} | |
}, | |
// for local json server | |
// setup(server) { | |
// server.use(process.env.API_BASE_URL, jsonServer.router('test/mock/db.json')); | |
// } | |
}, | |
plugins: [ | |
new HtmlwebpackPlugin({ | |
template: './src/templates/index.html' | |
}), | |
new webpack.EnvironmentPlugin(['NODE_ENV', 'API_BASE_URL']) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment