tj / frontend-boilerplate

webpack-react-redux-babel-autoprefixer-hmr-postcss-css-modules-rucksack-boilerplate (unmaintained, I don't use it anymore)
2.93k stars 268 forks source link

Add webpack modulesDirectories option and replace ES7 autobinding with ES7 property declaration #76

Open dbertella opened 8 years ago

dbertella commented 8 years ago

I think the modulesDirectories option in webpack is a realy handy way to handle modules, and I'm not sure about autobinding, but I don't think it's the best way to use methods since it will bind a new function in every render cycle. I may be wrong, feel free to deny it if I am

eddyystop commented 8 years ago

Webpack's moduleDirectories is a very nice way to walk directories a la node_modules. I used it for shared folders.

However you will have to create a Webpack bundle before running tests on Node, and that slows the tests down.

Babel has a module resolver feature and with babel-plugin-resolver you obtain the same features that NODE_PATH provides Node.

I've switched to babel-plugin-resolver because I can run tests using babel-register alone which is faster than creating a Webpack bundle. It also doesn't tie me into Webpack for a build system..

You of course will still have to create a bundle if you require Webpack loaders e.g. import style from './style.css'.

dbertella commented 8 years ago

Sure, you are right about it I'll have to use karma to run test actually, I will look into it than. Can be useful.

2016-05-05 12:41 GMT+02:00 Eddyystop notifications@github.com:

Webpack's moduleDirectories is a very nice way to walk directories a la node_modules. I used it for shared folders.

However you will have to create a Webpack bundle before running tests on Node, and that slows the tests down.

Babel has a module resolver feature and with babel-plugin-resolver you obtain the same features that NODE_PATH provides Node.

I've switched to babel-plugin-resolver because I can run tests using babel-register which is faster than creating a Webpack bundle.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/tj/frontend-boilerplate/pull/76#issuecomment-217122090

Daniele Bertella Front end developer

+39.340.490.57.80 LinkedIn: danielebertella http://it.linkedin.com/in/danielebertella/ Twitter: _denb https://twitter.com/_denb www.danielebertella.com

tracker1 commented 8 years ago

I've been preferring to set aliases, so that I can set an alias to "lib", "shared", etc... and just require('lib/...') It's a bit of a break from the "node way" but, it's worked for me...

A somewhat convoluted webpack config

tj commented 8 years ago

I've been using browserify instead now, not sure when I'll have time to update this though