P.Brian.Mackey
P.Brian.Mackey

Reputation: 44295

Getting started with React

I'm setting up React for the first time following the tutorial. I created main.js and ran the various commands. The last command gives me error:

To install React DOM and build your bundle with webpack:

$ npm install --save react react-dom babel-preset-react
$ webpack

When I run webpack I receive error:

Output filename not configured

It points me to the usage docs. The usage docs tells me the command line interface expects input of the form:

webpack <entry> <output>

Obviously the command webpack as shown in the react tutorial does not meet this criteria. What did I do wrong?

Upvotes: 0

Views: 182

Answers (1)

danielfeelfine
danielfeelfine

Reputation: 1884

Create a webpack.config.js, eg.:

module.exports = {
  context: __dirname + "/app",
  entry: {
    jsx: './main.js',
    html: './index.html'
  },
  output: {
    path: __dirname + '/dist',
    filename: 'bundle.js'
  }
}

Upvotes: 1

Related Questions