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
7 changes: 4 additions & 3 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ if (process.env.NODE_ENV === 'production') {
app.use('/static', express.static(__dirname + '/../dist'));
} else {
const compiler = webpack(webpackConfig);
app.use(webpackDevMiddleware(compiler, {
noInfo: true,
app.use(webpackDevMiddleware(compiler, {
noInfo: true,
publicPath: webpackConfig.output.publicPath })
);
app.use(webpackHotMiddleware(compiler));
Expand All @@ -49,7 +49,8 @@ app.use((req, res, next) => {
res.status(200).end(renderPage(componentHtml));
});

const server = app.listen(3002, () => {
var port = process.env.PORT ? process.env.PORT : 3002;
const server = app.listen(port, () => {
const host = server.address().address;
const port = server.address().port;
console.log(`Listening at http://${host}:${port}`);
Expand Down
36 changes: 18 additions & 18 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var babelSettings = {
plugins: [
['react-transform', {
transforms: [
{
{
transform: 'react-transform-hmr',
imports: [ 'react'],
locals: [ 'module' ]
Expand All @@ -67,22 +67,22 @@ if (process.env.NODE_ENV === 'production') {
],
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loader: 'babel',
exclude: /node_modules/,
query: {
{
test: /\.(js|jsx)$/,
loader: 'babel',
exclude: /node_modules/,
query: {
presets: ['react', 'es2015'],
plugins: [
"transform-react-inline-elements",
"transform-react-constant-elements"
]
]
},
include: __dirname
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader', 'autoprefixer-loader?' + browsers, 'sass')
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!autoprefixer-loader?' + browsers + "!sass-loader")
},
]
},
Expand All @@ -94,8 +94,8 @@ if (process.env.NODE_ENV === 'production') {
}),
new ExtractTextPlugin('app.css'),
new webpack.optimize.UglifyJsPlugin({
minimize: true,
compress: {
minimize: true,
compress: {
warnings: false
}
})
Expand All @@ -106,14 +106,14 @@ if (process.env.NODE_ENV === 'production') {
devtool: 'eval-source-map',
module: {
loaders: [
{
test: /\.(js|jsx)$/,
loaders: ['babel?' + JSON.stringify(babelSettings)],
{
test: /\.(js|jsx)$/,
loaders: ['babel?' + JSON.stringify(babelSettings)],
exclude: /node_modules/
},
{
test: /\.scss$/,
loaders: ['style','css?sourceMap', 'autoprefixer-loader?' + browsers, 'sass']
{
test: /\.scss$/,
loaders: ['style','css?sourceMap', 'autoprefixer-loader?' + browsers, 'sass']
},
]
},
Expand Down