alt-tutorial icon indicating copy to clipboard operation
alt-tutorial copied to clipboard

Change to webpack

Open afilp opened this issue 9 years ago • 4 comments

Feel free to make any improvements.

Note that this existing code will not work on Windows: "start": "npm run build && open 'index.html'"

The open command is not recognized on Windows shell.

I only kept it because this is how you had it on master before I create this branch. I believe it should be changed if you want Windows users to have a running app without problems.

afilp avatar May 21 '15 16:05 afilp

So why webpack over browserify in this case? Seems to add a lot of overhead.

I chose react's jsx transformer over babel because I wanted to highlight how you could do this in a pre-babel world. Maybe it makes sense to make this all babel?

goatslacker avatar May 21 '15 22:05 goatslacker

I really don't have a strong opinion, I just saw that you are using babel on the other example (alt-search-docs) and thought of converting this too.

It is not a big deal, indeed there is no real gain from this. The only reason you would do that would be for consistency from project to project, nothing else (on the other hand you give an example with react's jsx transformer here).

When you say a lot of overhead you mean at the compiled (final) application or just during the development? You mean that babel makes the compiled application heavier? (unnoticeable obviously for this small project, still one must think of all consequences)

afilp avatar May 21 '15 22:05 afilp

I don't have any issues with babel, I think it's great. I intended this to serve as an example for people who want to use the react transformer for their code rather than using babel. This shows off how you can still use all the react transformer stuff with Alt. I'm not sure if this is even a valid use case any more as many more people are migrating over to babel.

As far as webpack vs browserify. You're removing 1 line of npm config code and replacing it with 26 lines of webpack config code to do the same exact thing :) That's what I mean by overhead.

I am open to this though, if we do end up going this route lets drop the jsx from the files since they're not necessary with babel.

goatslacker avatar May 21 '15 23:05 goatslacker

firstly sorry for adding that open index.html I forget people are on windows too.

secondly I am for the idea of moving this over to use babel, as it would keep consistency with the iso examples and as you mention we could drop the jsx from the files. I was a bit confused on this, moving between the 2 examples.

As for browserify vs webpack, I prefer the ease of use with browserify for this example. I would say possibly having an alternative npm build-webpack command or something could be an idea but not sure if this is standard behaviour.

svnm avatar May 22 '15 02:05 svnm