Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

Commit

Permalink
Updated to webpack 2 resolves #9
Browse files Browse the repository at this point in the history
  • Loading branch information
skolmer committed Mar 29, 2017
1 parent 1dbd65b commit b711059
Show file tree
Hide file tree
Showing 8 changed files with 4,497 additions and 49 deletions.
8 changes: 7 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"browser": true,
"node": true
},
"ignore": [
"node_modules"
],
"extends": [
"eslint:recommended",
"plugin:import/errors",
Expand Down Expand Up @@ -66,6 +69,9 @@
"webpack": {
"config": "webpack.config.dev.js"
}
}
},
"import/ignore": [
"node_modules"
]
}
}
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
node_modules
npm-debug.log
dist
.vscode/chrome
yarn.lock
.vscode/chrome
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,5 @@
"search.exclude": {
"dist/**": true
},
"typescript.check.workspaceVersion": false
"typescript.check.tscVersion": false
}
44 changes: 22 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,32 @@
},
"homepage": "https://github.com/skolmer/react-hot-boilerplate-vscode",
"devDependencies": {
"babel-core": "^6.14.0",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.5",
"babel-plugin-transform-react-jsx-source": "^6.9.0",
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-core": "^6.24.0",
"babel-eslint": "^7.2.1",
"babel-loader": "^6.4.1",
"babel-plugin-transform-react-jsx-source": "^6.22.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-react": "^6.23.0",
"babel-preset-react-optimize": "^1.0.1",
"babel-preset-stage-0": "^6.5.0",
"cross-env": "^2.0.1",
"eslint": "^3.5.0",
"eslint-import-resolver-webpack": "^0.6.0",
"eslint-plugin-babel": "^3.3.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-lodash": "^1.10.3",
"eslint-plugin-react": "^6.3.0",
"babel-preset-stage-0": "^6.22.0",
"cross-env": "^3.2.4",
"eslint": "^3.18.0",
"eslint-import-resolver-webpack": "^0.8.1",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-lodash": "^2.4.0",
"eslint-plugin-react": "^6.10.3",
"ghooks": "^1.3.2",
"html-webpack-plugin": "^2.22.0",
"react-hot-loader": "^3.0.0-beta.5",
"rimraf": "^2.5.4",
"webpack": "^1.13.2",
"webpack-dev-server": "^1.16.1"
"html-webpack-plugin": "^2.28.0",
"react-hot-loader": "^3.0.0-beta.6",
"rimraf": "^2.6.1",
"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2"
},
"dependencies": {
"lodash": "^4.16.1",
"react": "^15.3.2",
"react-dom": "^15.3.2"
"lodash": "^4.17.4",
"react": "^15.4.2",
"react-dom": "^15.4.2"
},
"config": {
"host": "localhost",
Expand Down
4 changes: 2 additions & 2 deletions src/Counter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component } from 'react'
import _ from 'lodash'
import add from 'lodash/add'

class Counter extends Component {
constructor(props) {
Expand All @@ -10,7 +10,7 @@ class Counter extends Component {

tick() {
this.setState({
counter: _.add(this.state.counter, this.props.increment)
counter: add(this.state.counter, this.props.increment)
});
}

Expand Down
26 changes: 17 additions & 9 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,41 @@ const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
devtool: '#cheap-module-source-map',
devtool: 'cheap-module-source-map',
entry: [
'react-hot-loader/patch',
`webpack-dev-server/client?http://${process.env.npm_package_config_host}:${process.env.npm_package_config_port}`,
'webpack/hot/only-dev-server',
'react-hot-loader/patch',
'./src/index.dev'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
filename: 'bundle.js'
},
plugins: [
new webpack.DefinePlugin({
'__DEV__': true
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.NamedModulesPlugin(),
new HtmlWebpackPlugin({
template: 'index.html', // Load a custom template
inject: 'body' // Inject all scripts into the body
template: 'index.html', // Load a custom template
inject: 'body' // Inject all scripts into the body
})
],
module: {
loaders: [{
rules: [{
test: /\.jsx?$/,
loaders: ['babel?retainLines=true'],
include: path.join(__dirname, 'src')
use: [{
loader: 'babel-loader'
}]
}]
},
resolve: {
modules: [
path.join(__dirname, 'src'),
'node_modules'
],
extensions: ['.js', '.jsx']
}
};
31 changes: 19 additions & 12 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ module.exports = {
filename: 'bundle.js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.bundle.js'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin({
'__DEV__': false,
'process.env': {
Expand All @@ -33,18 +27,31 @@ module.exports = {
output: {
comments: false
}
}),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks: Infinity,
filename: 'vendor.bundle.js'
}),
new HtmlWebpackPlugin({
template: 'index.html', // Load a custom template
inject: 'body', // Inject all scripts into the body
template: 'index.html', // Load a custom template
inject: 'body', // Inject all scripts into the body
hash: true
})
],
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
rules: [{
test: /\.jsx?$/,
use: [{
loader: 'babel-loader'
}]
}]
},
resolve: {
modules: [
path.join(__dirname, 'src'),
'node_modules'
],
extensions: ['.js', '.jsx']
}
};
Loading

0 comments on commit b711059

Please sign in to comment.