Skip to content

Commit

Permalink
Do not override output.publicPath
Browse files Browse the repository at this point in the history
It is now correctly set by Webpacker.

Fixes renchap#29
  • Loading branch information
renchap committed May 27, 2017
1 parent f49d6b5 commit 2d4b3d6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,7 @@ module.exports = merge(sharedConfig, ...)

If you need to change your configuration manually:

1. set the public URL used to load `webpack-dev-server` assets
```js
{
output: {
publicPath: 'http://localhost:8080'
}
}
```

2. add `react-hot-loader/babel` to your `babel-loader` rules:
1. add `react-hot-loader/babel` to your `babel-loader` rules:
```javascript
{
module: {
Expand All @@ -159,7 +150,7 @@ If you need to change your configuration manually:
}
```
3. prepend `react-hot-loader/patch` to your entries:
2. prepend `react-hot-loader/patch` to your entries:
```javascript
{
entry:
Expand All @@ -168,7 +159,7 @@ If you need to change your configuration manually:
}
```
4. you now need to use `webpack-dev-server` (in place of `webpack` or `webpack-watcher`). Make sure the following line is in your development.rb:
3. you now need to use `webpack-dev-server` (in place of `webpack` or `webpack-watcher`). Make sure the following line is in your development.rb:
```ruby
config.x.webpacker[:dev_server_host] = 'http://localhost:8080/'
```
Expand All @@ -177,7 +168,7 @@ and start `webpack-dev-server` in hot replacement mode:
./bin/webpack-dev-server --hot
```
5. finally opt in to HMR from your pack files:
4. finally opt in to HMR from your pack files:
```es6
import SomeRootReactComponent from 'components/some-root-react-component'
import WebpackerReact from 'webpacker-react/hmr'
Expand All @@ -188,6 +179,8 @@ and start `webpack-dev-server` in hot replacement mode:
WebpackerReact.renderOnHMR(SomeRootReactComponent) )
```
You also need to ensure that `output.publicPath` are correctly set. This should be already handled by Webpacker.
## Development
To work on this gem locally, you first need to clone and setup [the example application](https://github.com/renchap/webpacker-react-example).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@ import webpack from 'webpack'
import merge from 'webpack-merge'

function configureHotModuleReplacement(originalConfig) {
const webpackDevServerAddr = process.env.WEBPACK_DEV_SERVER_ADDR || 'http://localhost:8080/'
const config = merge(
originalConfig,
{
output: {
// needed for HMR to know where to load the hot update chunks
publicPath: webpackDevServerAddr
},
plugins: [
new webpack.NamedModulesPlugin()
]
Expand Down
10 changes: 2 additions & 8 deletions javascript/webpacker_react-npm-module/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1573,7 +1573,7 @@ lodash.cond@^4.3.0:
version "4.5.2"
resolved "https://registry.yarnpkg.com/lodash.cond/-/lodash.cond-4.5.2.tgz#f471a1da486be60f6ab955d17115523dd1d255d5"

lodash@^4.0.0, lodash@^4.2.0, lodash@^4.3.0, "lodash@~> 4":
lodash@^4.0.0, lodash@^4.2.0, lodash@^4.3.0:
version "4.17.4"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae"

Expand Down Expand Up @@ -2010,13 +2010,7 @@ restore-cursor@^1.0.1:
exit-hook "^1.0.0"
onetime "^1.0.0"

rimraf@2, rimraf@^2.2.8:
version "2.6.1"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d"
dependencies:
glob "^7.0.5"

rimraf@~2.5.1, rimraf@~2.5.4:
rimraf@2, rimraf@^2.2.8, rimraf@~2.5.1, rimraf@~2.5.4:
version "2.5.4"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04"
dependencies:
Expand Down

0 comments on commit 2d4b3d6

Please sign in to comment.