Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTom M
10,056 PointsInvalid configuration object when running npm run build with webpack 2.2.1
How to migrate this from webpack 1 to webpack 2?
3 Answers
Alex _
17,107 PointsI don't know the details about migrating from webpack 1 to 2, but it seems that the "excludes" property that Isaac Lee puts in the webpack.config.js file at 3:32 in the video, changed to "exclude"(singular instead of plural). That small change made everything work for me.
webpack.config.js
var webpackConfig = {
entry: "./src/index.js",
output: {
path: __dirname + "/build",
filename: "index.js"
},
module: {
loaders: [
{
loader: "babel-loader",
test: /.js$/,
exclude: /node_modules/
}
]
}
};
module.exports = webpackConfig;
Oziel Perez
61,321 PointsAs of webpack 2.0, "loaders" should be renamed to "rules" and "excludes" should be "exclude". Check which version of webpack you installed by looking at your package.json file and change accordingly.
Allen Johnson
7,417 PointsThank you! Making both of these updates together resolved the issues I was having.
Jamie Lynn
13,003 PointsWorks great!!! Thank you Oziel Perez!
Michael Liendo
15,326 PointsBest step is to view the webpack docs/guides: https://webpack.js.org/guides/ In case you've followed their docs in the past, rest assured, the docs in V2 are pretty well written ;)
Here are their steps for migrating: https://webpack.js.org/guides/migrating/