forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[added] react-hot-loader when developing docs
+ Enable webpack-hot-loader for css changes + Enable react-hot-loader for component changes with state retention. + Better fail over when nodemon process fail + If you change the webpack configuration this will restart the webpack-dev-server. + Video link to demo this feature in docs readme.
- Loading branch information
Showing
17 changed files
with
140 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,8 @@ | |
"comma-spacing": 0, | ||
"react/no-multi-comp": 0, | ||
"react/prop-types": 0 | ||
}, | ||
"globals": { | ||
"CodeMirror": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,18 @@ | ||
import config from './webpack.config'; | ||
export default config({docs: true}); | ||
import yargs from 'yargs'; | ||
|
||
const argv = yargs | ||
.alias('p', 'optimize-minimize') | ||
.alias('d', 'debug') | ||
.option('port', { | ||
default: '8080', | ||
type: 'string' | ||
}) | ||
.argv; | ||
|
||
export default config({ | ||
docs: true, | ||
development: argv.debug, | ||
optimize: argv.optimizeMinimize, | ||
port: parseInt(argv.port) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import _ from 'lodash'; | ||
import webpack from 'webpack'; | ||
|
||
function addWebpackDevServerScripts(entries, webpackDevServerAddress) { | ||
let clientScript = `webpack-dev-server/client?${webpackDevServerAddress}`; | ||
let webpackScripts = ['webpack/hot/dev-server', clientScript]; | ||
return _.mapValues(entries, entry => webpackScripts.concat(entry)); | ||
} | ||
|
||
export default (config, options) => { | ||
if (options.development && options.docs) { | ||
let webpackDevServerAddress = `http://localhost:${options.port}`; | ||
config = _.extend({}, config, { | ||
entry: addWebpackDevServerScripts(config.entry, webpackDevServerAddress), | ||
output: _.extend({}, config.output, { | ||
publicPath: `${webpackDevServerAddress}/assets/` | ||
}), | ||
module: _.extend({}, config.module, { | ||
loaders: config.module.loaders.map(value => { | ||
if (/js/.test(value.test.toString())) { | ||
return _.extend({}, value, { | ||
loader: 'react-hot!' + value.loader | ||
}); | ||
} | ||
else { | ||
return value; | ||
} | ||
}) | ||
}), | ||
// Remove extract text plugin from dev workflow so hot reload works on css. | ||
plugins: config.plugins.concat([ | ||
new webpack.NoErrorsPlugin() | ||
]) | ||
}); | ||
|
||
return config; | ||
} | ||
|
||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters