Skip to content

Commit 0b9416b

Browse files
committed
Remove hacks to alias Redux to src folder in examples
We don’t actively develop the source anymore for this to be useful. This only creates confusion and, additionally, breaks hot reloading because of BABEL_ENV conflicts with the root .babelrc.
1 parent c12e8af commit 0b9416b

File tree

10 files changed

+0
-173
lines changed

10 files changed

+0
-173
lines changed

docs/introduction/Examples.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
Redux is distributed with a few examples in its [source code](https://github.com/reactjs/redux/tree/master/examples).
44

5-
>##### Note on Copying
6-
>If you copy Redux examples outside their folders, you can delete some lines at the end of their `webpack.config.js` files. They follow a “You can safely delete these lines in your project.” comment.
7-
85
## Counter Vanilla
96

107
Run the [Counter Vanilla](https://github.com/reactjs/redux/tree/master/examples/counter-vanilla) example:

examples/async/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ module.exports = {
2828
]
2929
}
3030
}
31-
32-
33-
// When inside Redux repo, prefer src to compiled version.
34-
// You can safely delete these lines in your project.
35-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
36-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
37-
var fs = require('fs')
38-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
39-
// Resolve Redux to source
40-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
41-
// Our root .babelrc needs this flag for CommonJS output
42-
process.env.BABEL_ENV = 'commonjs'
43-
// Compile Redux from source
44-
module.exports.module.loaders.push({
45-
test: /\.js$/,
46-
loaders: ['babel'],
47-
include: reduxSrc
48-
})
49-
}

examples/counter/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ module.exports = {
2828
]
2929
}
3030
}
31-
32-
33-
// When inside Redux repo, prefer src to compiled version.
34-
// You can safely delete these lines in your project.
35-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
36-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
37-
var fs = require('fs')
38-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
39-
// Resolve Redux to source
40-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
41-
// Our root .babelrc needs this flag for CommonJS output
42-
process.env.BABEL_ENV = 'commonjs'
43-
// Compile Redux from source
44-
module.exports.module.loaders.push({
45-
test: /\.js$/,
46-
loaders: [ 'babel' ],
47-
include: reduxSrc
48-
})
49-
}

examples/real-world/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ module.exports = {
2828
]
2929
}
3030
}
31-
32-
33-
// When inside Redux repo, prefer src to compiled version.
34-
// You can safely delete these lines in your project.
35-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
36-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
37-
var fs = require('fs')
38-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
39-
// Resolve Redux to source
40-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
41-
// Our root .babelrc needs this flag for CommonJS output
42-
process.env.BABEL_ENV = 'commonjs'
43-
// Compile Redux from source
44-
module.exports.module.loaders.push({
45-
test: /\.js$/,
46-
loaders: [ 'babel' ],
47-
include: reduxSrc
48-
})
49-
}

examples/shopping-cart/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,22 +34,3 @@ module.exports = {
3434
]
3535
}
3636
}
37-
38-
39-
// When inside Redux repo, prefer src to compiled version.
40-
// You can safely delete these lines in your project.
41-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
42-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
43-
var fs = require('fs')
44-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
45-
// Resolve Redux to source
46-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
47-
// Our root .babelrc needs this flag for CommonJS output
48-
process.env.BABEL_ENV = 'commonjs'
49-
// Compile Redux from source
50-
module.exports.module.loaders.push({
51-
test: /\.js$/,
52-
loaders: [ 'babel' ],
53-
include: reduxSrc
54-
})
55-
}

examples/todomvc/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,3 @@ module.exports = {
3333
]
3434
}
3535
}
36-
37-
38-
// When inside Redux repo, prefer src to compiled version.
39-
// You can safely delete these lines in your project.
40-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
41-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
42-
var fs = require('fs')
43-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
44-
// Resolve Redux to source
45-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
46-
// Our root .babelrc needs this flag for CommonJS output
47-
process.env.BABEL_ENV = 'commonjs'
48-
// Compile Redux from source
49-
module.exports.module.loaders.push({
50-
test: /\.js$/,
51-
loaders: [ 'babel' ],
52-
include: reduxSrc
53-
})
54-
}

examples/todos-with-undo/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,3 @@ module.exports = {
2626
}]
2727
}
2828
}
29-
30-
31-
// When inside Redux repo, prefer src to compiled version.
32-
// You can safely delete these lines in your project.
33-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
34-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
35-
var fs = require('fs')
36-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
37-
// Resolve Redux to source
38-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
39-
// Our root .babelrc needs this flag for CommonJS output
40-
process.env.BABEL_ENV = 'commonjs'
41-
// Compile Redux from source
42-
module.exports.module.loaders.push({
43-
test: /\.js$/,
44-
loaders: ['babel'],
45-
include: reduxSrc
46-
})
47-
}

examples/todos/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ module.exports = {
2828
]
2929
}
3030
}
31-
32-
33-
// When inside Redux repo, prefer src to compiled version.
34-
// You can safely delete these lines in your project.
35-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
36-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
37-
var fs = require('fs')
38-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
39-
// Resolve Redux to source
40-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
41-
// Our root .babelrc needs this flag for CommonJS output
42-
process.env.BABEL_ENV = 'commonjs'
43-
// Compile Redux from source
44-
module.exports.module.loaders.push({
45-
test: /\.js$/,
46-
loaders: [ 'babel' ],
47-
include: reduxSrc
48-
})
49-
}

examples/tree-view/webpack.config.js

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ module.exports = {
2828
]
2929
}
3030
}
31-
32-
33-
// When inside Redux repo, prefer src to compiled version.
34-
// You can safely delete these lines in your project.
35-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
36-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
37-
var fs = require('fs')
38-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
39-
// Resolve Redux to source
40-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
41-
// Our root .babelrc needs this flag for CommonJS output
42-
process.env.BABEL_ENV = 'commonjs'
43-
// Compile Redux from source
44-
module.exports.module.loaders.push({
45-
test: /\.js$/,
46-
loaders: [ 'babel' ],
47-
include: reduxSrc
48-
})
49-
}

examples/universal/webpack.config.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,3 @@ module.exports = {
3131
]
3232
}
3333
}
34-
35-
// When inside Redux repo, prefer src to compiled version.
36-
// You can safely delete these lines in your project.
37-
var reduxSrc = path.join(__dirname, '..', '..', 'src')
38-
var reduxNodeModules = path.join(__dirname, '..', '..', 'node_modules')
39-
var fs = require('fs')
40-
if (fs.existsSync(reduxSrc) && fs.existsSync(reduxNodeModules)) {
41-
// Resolve Redux to source
42-
module.exports.resolve = { alias: { 'redux': reduxSrc } }
43-
// Our root .babelrc needs this flag for CommonJS output
44-
process.env.BABEL_ENV = 'commonjs'
45-
// Compile Redux from source
46-
module.exports.module.loaders.push({
47-
test: /\.js$/,
48-
loaders: [ 'babel' ],
49-
include: reduxSrc,
50-
})
51-
}

0 commit comments

Comments
 (0)