I’m having trouble getting my first loader to work while converting to Webpack 2. I cannot find a simple webpack 2 config for setting up Babel and few common plugins and loaders. I’ve followed the whats new gist post and I’ve made many changes. The rules say not to post here about questions and tech support but its July and I can’t get a response anywhere else in two days now.
6 thoughts on “Is there a complete example config for Webpack 2?”
Comments are closed.
I’m using
2.1.0-beta.19
.Here is my resolve:
I’m still using Babel 5 on this project and I’m planning to upgrade to 6 once I get Webpack 2 working to some degree:
I’m getting a lot of messages like this:
ERROR in Entry module not found: Error: Can't resolve 'babel-loader?{"optional":["runtime"],"stage":0,"cacheDirectory":"/tmp"}' in '/opt/project/app/webpack'
Sorry the the snap weak reply. I thought about it and then realized that I need
resolveLoader
as that was commented out. Then to start with I copied all of the settings fromresolve
intoresolveLoader
and I’ll clean it up after its [all 100%%] working.Now it seems I need to get the exports and expose working. I’m maintaining a test bed for Phalcon and Webpack integration and it uses some old JS tech that is funky.
This does’t seem to work.
@dschissler – My suggestion would be to start here https://github.com/gdi2290/angular2-webpack2-starter
@gdi2290‘s Webpack2 example has a pretty complete dev config.
I am also switching over to webpack 2. I have a complete starter project with React and Redux over here: https://github.com/sapientglobalmarkets/react-redux-seed. However, like everyone else, I am struggling through the issues list to piece together the concepts. It would be great if someone from the webpack team would review my config and comment on my use of webpack 2. I promise to maintain this example in accordance with your feedback.
To illustrate the importance of good examples, let me describe the latest issue that I am running into. It’s the use of
resolve.modules
. Inwebpack-common.config.js
, I have:This allows me to specify all my imports relative to the
src
folder, instead of paths like../../../xyz.js
. This is working great of JavaScript files, but I am running into a snag with css files. Whileurl()
andcomposes
are picking up the correct modules starting from thesrc
folder:@import
is not working as expected. I have to specify the full relative path:I don’t even know if this is an issue with webpack, or css-loader or something else.
In summary, I think it is important to maintain some good quality examples as webpack 2 development proceeds. In absence of docs, this would be a great resource for people to continue working with webpack 2, minimizing the time wasted on trial and error.
The webpack team just released new documentation for Webpack 2, which has some good examples of the config file
I created template for simple JS apps where I using Webpack 2, Webpack-dev-server and Babel.
Maybe it could be useful to someone who is looking for basic config..
https://github.com/bultas/minimal