Skip to content

Instantly share code, notes, and snippets.

@selbekk
Last active May 29, 2017 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selbekk/ff8b876b6aa8e073ee9dc731da22ab79 to your computer and use it in GitHub Desktop.
Save selbekk/ff8b876b6aa8e073ee9dc731da22ab79 to your computer and use it in GitHub Desktop.
A simple front end build stack

A simple front end build stack

Here's a very bare bones approach.

First, create a webpack.config.js file. This is what goes in:

const config = {
  entry: 'src/index.js', // path to your app entry point
  output: {
    path: path.resolve(__dirname, 'dist'), // output goes to the dist folder relative to this file
    filename: 'bundle.js',
  },
  module: {
    rules: [ // Here is all your loaders etc, compilators etc
      { 
        test: /.jsx?$/, // run this loader for all files that end in .js and .jsx
        loader: 'babel-loader', // the loader is called babel-loader
        options: { // it accepts options, which can also be set in a .babelrc file if you want
          presets: ['latest', 'react'], // we want to transpile ES2015 to ES5 and react JSX code 
        }
      }
    ],
  },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment