Skip to content

Commit 9df5490

Browse files
committed
make dev server work again
1 parent 93ad932 commit 9df5490

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

lib/hmr-server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var slash = require('slash')
66
module.exports = function (webpackConfig, port, log, distDir, rootPath) {
77
var app = express()
88
var compiler = webpack(webpackConfig)
9-
var assetPath = rootPath ? slash(path.join(rootPath, 'src/')) : '/src/';
9+
var assetPath = rootPath ? slash(path.resolve(rootPath)) : '/';
1010
var basePath = rootPath ? slash(rootPath + '*') : '*';
1111

1212
app.use('/files', express.static(path.join(distDir, 'files')))

lib/rcs.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,7 @@ RCS.prototype.createContentsFile = function () {
289289

290290
if (self.opts.dev) {
291291
hmrServer(self.getWebpackConfig(), self.opts.dev, self.log, path.join(self.stageDir, 'dist'), this.opts.root)
292-
}
293-
if (!self.opts.dev) {
292+
} else {
294293
return distContentsFile()
295294
}
296295
};
@@ -371,18 +370,16 @@ RCS.prototype.getWebpackConfig = function () {
371370
fs: 'empty'
372371
},
373372
plugins: [
374-
375373
new DocgenPlugin({
376374
files: self.reactDocGenFiles,
377375
stageDir: self.stageDir,
378376
log: self.log
379377
}),
380378
new CopyWebpackPlugin(this.createStaticFileObject()),
381379
new webpack.optimize.OccurenceOrderPlugin(),
382-
383380
new webpack.DefinePlugin({
384381
'process.env': {
385-
'NODE_ENV': JSON.stringify('development')
382+
'NODE_ENV': JSON.stringify('production')
386383
}
387384
}),
388385
new webpack.optimize.UglifyJsPlugin({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"start": "cross-env NODE_ENV=development node bin/rcs 'example/components/**/*.js' -v -d",
1515
"clean": "rimraf rcs-tmp/*",
1616
"styleguide": "node bin/rcs 'example/components/**/*.js' -v",
17-
"dev": "cross-env NODE_ENV=development node ./bin/rcs ./example/components/**/*.js -s ./example/styledComponents/**/*.js -r /react-component-styleguide -v -c ./example/styleguide.js -d",
17+
"dev": "cross-env NODE_ENV=development node ./bin/rcs ./example/components/**/*.js -s ./example/styledComponents/**/*.js -v -c ./example/styleguide.js -d",
1818
"pages:build": "cross-env NODE_ENV=production node ./bin/rcs ./example/components/**/*.js -s ./example/styledComponents/**/*.js -r /react-component-styleguide -v -c ./example/styleguide.js",
1919
"pages:deploy": "gh-pages -d ./styleguide/src -r https://github.com/NogsMPLS/react-component-styleguide.git -b gh-pages",
2020
"pages": "npm run pages:build && npm run pages:deploy && rimraf ./styleguide"

0 commit comments

Comments
 (0)