survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

Typo/bug in "Advanced Techniques--Configuring React" #92

Closed abustamam closed 8 years ago

abustamam commented 8 years ago

I'm really liking the separation between Webpack and React! I feel like I'm finally understanding Webpack and its various configuration methods.

I ran into a tiny bug in the Advanced Techniques chapter though.

https://github.com/survivejs/webpack/blame/b57e8e4f5fe9b1e8ebf7ed5582f953e4d77a38bf/manuscript/advanced_techniques/05_configuring_react.md#L143

This line did not work:

process.env.BABEL_ENV = TARGET;

I think this was based on an older version of the book, where TARGET was equal to process.env.npm_lifecycle_event.

So I just dug up the older copy of the book and it worked fine.

const TARGET = process.env.npm_lifecycle_event
process.env.BABEL_ENV = TARGET

I also changed the switch case:

switch (TARGET) {
/* ... */
}

Less important, there are some weird lines that actually ended up making it to the book:

leanpub-start-insert
leanpub-end-insert

I don't see that syntax anywhere else, but I might be missing something.

bebraw commented 8 years ago

I added the line there so that the chapter works better standalone. I think the Babel section has to grow into a chapter of its own eventually.

Those leanpub-start-insert and leanpub-end-insert lines are Leanpub specific formatting. The site actually parses those. Example. The problem is that GitHub doesn't support the syntax.

Thanks!

abustamam commented 8 years ago

Oh I see. Thanks for clarifying so quickly!