Skip to content

Commit

Permalink
ongoing webpack integration relax#71
Browse files Browse the repository at this point in the history
  • Loading branch information
magalhas committed Nov 16, 2015
1 parent f6054b8 commit e95510d
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"stage": 0
"presets": [
"es2015",
"stage-0",
"react"
]
}
1 change: 1 addition & 0 deletions .relaxrc.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"port": 8080,
"devPort": 8181,
"db": {
"uri": "mongodb://localhost/relax"
}
Expand Down
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import rc from 'rc';

export default rc('relax', {
port: 8080,
devPort: 8181,
db: {
uri: 'mongodb://localhost/relax'
}
Expand Down
1 change: 0 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
require('babel/register');
require('./app');
8 changes: 4 additions & 4 deletions lib/components/dnd/droppable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,15 @@ export default class Droppable extends Component {

hasChildren () {
const children = this.props.children;
let hasChildren = false;
var _hasChildren = false;
if (children) {
if (children instanceof Array) {
hasChildren = children.length > 0;
_hasChildren = children.length > 0;
} else if (children instanceof Object) {
hasChildren = true;
_hasChildren = true;
}
}
return hasChildren;
return _hasChildren;
}

showMarks () {
Expand Down
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"watch": "grunt watch"
},
"dependencies": {
"babel": "^5.8.23",
"babel": "^6.1.18",
"blueimp-md5": "^1.1.1",
"body-parser": "^1.13.3",
"classnames": "^2.1.3",
Expand Down Expand Up @@ -85,9 +85,14 @@
"winston": "^2.1.0"
},
"devDependencies": {
"autoprefixer-loader": "^3.1.0",
"babel-core": "^6.1.21",
"babel-eslint": "^4.1.3",
"babel-runtime": "^5.8.25",
"babelify": "^6.3.0",
"babel-loader": "^6.1.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18",
"babel-preset-stage-0": "^6.1.18",
"babelify": "^7.2.0",
"eslint": "^1.6.0",
"eslint-config-relax": "^1.0.5",
"eslint-plugin-react": "^3.5.1",
Expand All @@ -99,11 +104,15 @@
"grunt-contrib-uglify": "^0.10.0",
"grunt-contrib-watch": "^0.6.1",
"grunt-nodemon": "^0.4.0",
"less-loader": "^2.2.1",
"less-plugin-autoprefix": "^1.4.2",
"less-plugin-clean-css": "^1.5.1",
"nodemon": "^1.8.1",
"redux-devtools": "^3.0.0-beta-3",
"redux-immutable-state-invariant": "^1.1.1"
"redux-immutable-state-invariant": "^1.1.1",
"webpack": "^1.12.6",
"webpack-dev-server": "^1.12.1",
"webpack-hot-middleware": "^2.5.0"
},
"apps": [
{
Expand Down
58 changes: 58 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {join} from 'path';
import {
HotModuleReplacementPlugin,
NoErrorsPlugin,
DefinePlugin,
optimize
} from 'webpack';

import config from './config';

// import babelConfig from './.babelrc';

module.exports = {
// devtool: 'eval',
entry: {
admin: join(__dirname, '/lib/client/admin.js'),
auth: join(__dirname, '/lib/client/auth.js'),
public: join(__dirname, '/lib/client/public.js'),
// devServer: `webpack-dev-server/client?http://0.0.0.0:${config.devPort}`,
// hotPlug: 'webpack/hot/only-dev-server',
// server: join(__dirname, 'index.js')
},
output: {
path: join(__dirname, '/public'),
filename: '[name].js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
plugins: [
new optimize.OccurenceOrderPlugin(),
new optimize.CommonsChunkPlugin('common.js', ['admin', 'auth', 'public']),
// new HotModuleReplacementPlugin(),
new NoErrorsPlugin(),
// new DefinePlugin({
// __DEVELOPMENT__: true,
// __DEVTOOLS__: false
// })
],
module: {
loaders: [
{
test: /\.(js|jsx)$/,
// include: [join(__dirname, 'index.js'), join(__dirname, 'lib')],
loader: 'babel',
exclude: /node_modules/,
query: {
cacheDirectory: true
}
},
// {
// test: /\.(less|css)$/,
// include: [join(__dirname, 'assets/less')],
// loader: 'style!css!less!autoprefixer'
// }
]
}
};
18 changes: 18 additions & 0 deletions webpack.server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import path from 'path';
import webpack from 'webpack';
import WebpackDevServer from 'webpack-dev-server';

import config from './config';
import webpackConfig from './webpack.config';

new WebpackDevServer(webpack(webpackConfig), {
contentBase: path.resolve(__dirname, 'public'),
hot: true,
historyApiFallback: true
})
.listen(config.devPort, '0.0.0.0', (err, result) => {
if (err) {
console.log(err);
}
console.log('Listening at localhost:8080');
});

0 comments on commit e95510d

Please sign in to comment.