Skip to content

Commit

Permalink
fix(react-hot-loader): Support react 15.4.x
Browse files Browse the repository at this point in the history
In React 15.4.0 facebook completely removed ReactDOM from React package itself. React-Hot-Loader
depends on some internal libs inside react package which made it imposible to use since version 15.4
arrived. To work around this issue I had to make some changes which led to only support react 15.4+
in aik.

Related links:
https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html
gaearon/react-hot-loader#417 (comment)

Since this commit react-hot-loader (-r option) works only for react 15.4+
  • Loading branch information
d4rkr00t committed Nov 25, 2016
1 parent 65dc496 commit 203ad3a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/webpack/config-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function webpackConfigBuilder(filename, flags, params) {
loaders: (0, _loaders.loaders)(flags, params)
},
resolve: {
alias: { 'react/lib/ReactMount': 'react-dom/lib/ReactMount' },
modulesDirectories: [_path2.default.dirname(_path2.default.resolve(process.cwd(), filename)), 'web_modules', 'node_modules']
},
eslint: {
Expand Down
2 changes: 1 addition & 1 deletion lib/webpack/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function entryDev(filename, flags) {
const host = flags.host === '::' ? 'localhost' : flags.host;

return {
[entryName]: [require.resolve('./assets/public-path.js'), `${ require.resolve('webpack-dev-server/client') }?http://${ host }:${ flags.port }/`, require.resolve('webpack/hot/dev-server'), (0, _resolveToCwd2.default)(filename)]
[entryName]: [`${ require.resolve('webpack-dev-server/client') }?http://${ host }:${ flags.port }/`, require.resolve('webpack/hot/dev-server'), require.resolve('./assets/public-path.js'), (0, _resolveToCwd2.default)(filename)]
};
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aik",
"version": "0.12.1",
"version": "0.12.1-wip",
"description": "Frontend Playground",
"bin": "cli.js",
"main": "lib/index.js",
Expand Down
1 change: 1 addition & 0 deletions src/webpack/config-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default function webpackConfigBuilder(filename: string, flags: CLIFlags,
loaders: loaders(flags, params)
},
resolve: {
alias: { 'react/lib/ReactMount': 'react-dom/lib/ReactMount' },
modulesDirectories: [
path.dirname(path.resolve(process.cwd(), filename)),
'web_modules',
Expand Down
2 changes: 1 addition & 1 deletion src/webpack/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export function entryDev(filename: string, flags: CLIFlags): Entry {

return {
[entryName]: [
require.resolve('./assets/public-path.js'),
`${require.resolve('webpack-dev-server/client')}?http://${host}:${flags.port}/`,
require.resolve('webpack/hot/dev-server'),
require.resolve('./assets/public-path.js'),
resolveToCwd(filename)
]
};
Expand Down

0 comments on commit 203ad3a

Please sign in to comment.