Closed hophacker closed 8 years ago
Hi,
That !TARGET
is actually on purpose. It represents the path that gets triggered when you run the configuration outside of npm. That's when TARGET
is empty.
There could be room for improvement, though. It might be clearer to rewrite the code using a switch statement. They you would end up with something like this:
switch(TARGET) {
case 'start':
module.exports = {...};
case 'build':
module.exports = {...};
default:
module.exports = {...}
}
This could be refactored into ES6 compatible export default
form easily.
I see, thank you! Then what can we do next, add your comment That !TARGET is actually on purpose. It represents the path that gets triggered when you run the configuration outside of npm. That's when TARGET is empty.
or apply the changes when es6 syntax is imported in?
I'll think about this and do either. Comment guaranteed at least. Thanks for bringing this up. :+1:
You're welcome!
@hophacker Here's a little switch demo if you want to have a look. Let me know what you think. I'm still experimenting.
I think it's great!
On Tue, Apr 12, 2016 at 1:14 PM, Juho Vepsäläinen notifications@github.com wrote:
@hophacker https://github.com/hophacker Here's a little switch demo https://github.com/survivejs-demos/webpack-demo/tree/validator if you want to have a look. Let me know what you think. I'm still experimenting.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/survivejs/webpack/pull/75#issuecomment-208710184
冯杰 排忧网络技术有限责任公司 苏州工业园区星湖街328号创意产业园
Cell: 86-15862355582 Linkedin: https://www.linkedin.com/pub/jie-feng/7a/a2a/194
Prev: Comprehend Systems, 2010 Broadway #200, Redwood City, CA 94063 Education: The Johns Hopkins University, Master of Science
I ported the dev
version of the book to the scheme. Thanks. :+1:
Found this small mistake while reading this perfect webpack intro book. If
start
is empty,npm run ***
won't executewebpack
and the work flow won't come here.