Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server -d --hot --inline --progress --colors",
"build": "webpack --progress --colors"
"build": "ENV_TYPE=production webpack --progress --colors"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -34,28 +34,29 @@
"babel-preset-react": "^6.16.0",
"babel-preset-stage-1": "^6.16.0",
"babel-runtime": "^6.11.6",
"css-loader": "^0.25.0",
"css-loader": "^0.26.2",
"eslint": "^3.7.1",
"eslint-loader": "^1.5.0",
"eslint-plugin-react": "^6.3.0",
"file-loader": "^0.9.0",
"file-loader": "^0.10.1",
"style-loader": "^0.13.1",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.2",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1",
"webpack-hot-middleware": "^2.12.2"
},
"dependencies": {
"babel-polyfill": "^6.23.0",
"classnames": "^2.2.5",
"fbjs": "^0.8.5",
"material-ui": "^0.16.0",
"material-ui": "^0.17.0",
"react": "^15.4.0",
"react-addons-create-fragment": "^15.3.2",
"react-addons-pure-render-mixin": "^15.3.2",
"react-addons-transition-group": "^15.3.2",
"react-addons-update": "^15.3.2",
"react-dom": "^15.3.2",
"react-hot-loader": "^1.3.0",
"react-redux": "^4.4.5",
"react-redux": "^5.0.3",
"react-tap-event-plugin": "^2.0.0",
"redux": "^3.6.0"
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
s.parentNode.insertBefore(wf, s);
})();
</script>
<script src="./bundle.js"></script>
<script src="bundle.js"></script>
</body>
</html>
61 changes: 38 additions & 23 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
'use strict';
var path = require('path');
var webpack = require('webpack');
var fs = require("fs");
var BUILD = process.env.ENV_TYPE === 'production';
module.exports = {
context: __dirname,
devtool: BUILD ? 'source-map' : "eval",
resolve: {
extensions: ['.js', '.jsx', '.css']
},
entry: {
jsx: "./src/index.jsx",
css: "./src/main.css",
html: "./src/index.html",
bundle: ['babel-polyfill', "./src/index.jsx", "./src/main.css", "./src/index.html"],
},

output: {
path: __dirname + "/static",
filename: "bundle.js",
filename: '[name].js',
},
plugins: BUILD ? [
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
// Reference: http://webpack.github.io/docs/list-of-plugins.html#noerrorsplugin
// Only emit files when there are no errors

new webpack.NoEmitOnErrorsPlugin(),
// Reference: http://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin
// Minify all javascript, switch loaders to minimizing mode
new webpack.optimize.UglifyJsPlugin({minimize: true})
] : [],
module: {
preLoaders: [
//Eslint loader
{ test: /\.jsx?$/, exclude: /node_modules/, loader: "eslint-loader"},
],
loaders: [
{ test: /\.html$/, loader: "file?name=[name].[ext]" },
{ test: /\.css$/, loader: "file?name=[name].[ext]" },
{ test: /\.jsx?$/, exclude: /node_modules/, loaders: ["react-hot","babel-loader"]},
],
},
resolve: {
extensions: ['', '.js', '.jsx']
},
eslint: {
configFile: './.eslintrc'
},
};
loaders: [{
// JS LOADER
// Reference: https://github.com/babel/babel-loader
// Transpile .js files using babel-loader
// Compiles ES6 and ES7 into ES5 code
test: /\.jsx?$/i,
loaders: ['babel-loader'],
exclude: /node_modules/
},
{ test: /\.html$/, loader: "file-loader?name=[name].[ext]" },
{ test: /\.css$/, loader: "file-loader?name=[name].[ext]" }]
}
};