4 ms·
What's needed for Webpack 2: better documentation.
by octref 11y ago
What's needed for Webpack 2: better documentation.
- DanitaBaires 11y agoI strongly agree. I had to set up a React application not so long ago and the Webpack docs were completely useless. I ended up following a step by step guide made by someone else, which was really easy to follow and reason about: http://survivejs.com/webpack_react/developing_with_webpack/ http://survivejs.com/webpack_react/developing_with_webpack/
- matt4077 11y agoIndeed! I gave up trying to configure it to load files relative to the root and just lived with all the import '../../../lib/compents/...'. I just tried the new beta and – surprise – it works! I still think the structure of, say, Grunt is much nicer to work with – it's just code and easy to understsand & modify. Webpack has what must be the most awkward configuration file format currently in use. The website also looks like it's from the late 90ies, but I guess that's not too important. Apparently, it produces better output :(
- tobz 11y agoThis was definitely confusing at first for me, too, but with a little work, you can clean up your imports/requires with just a few lines: https://github.com/tobz/scryer/blob/master/webpack.config.js https://github.com/tobz/scryer/blob/master/webpack.config.js Note the resolve section. I have mine rooted at either app or node_modules, and I have some basic extensions set up. This lets me require something like 'components/CardBinder', which ends up then mapping to 'app/components/Cardbinder.jsx'. It ends up working nicely and lets me forget about precisely what type of thing I'm importing, instead focusing on the fact that I'm simply importing some resource, period.
- true_religion 11y agoI made my way through it, but in the end I went with JSPM because of the ES6 imports, and the fact that it handles installs from NPM and automatically adds it to the dependency list for you. It feels much more seamless than webpack.
- wildpeaks 11y agoYou can use a subfolder node_modules for using simpler paths (such as "components/something" instead of "../../components/something/index.js"). For example, if your entry point is in "/src/application.js", it can require('components/something') from folder "/src/node_modules/components/something". And that works in native Node, Browserify and Webpack, so you're not tied to a specific build tool. Any module in /src (and subfolders) first searches for modules in "/src/node_modules", but can still also load thirdparty npm-installed modules from the root "/node_modules".