Skip to content
Snippets Groups Projects
webpack.config.js 745 B
Newer Older
const config = {
  context: `${__dirname}/src`, // `__dirname` is root of project and `src` is source
scmoritz's avatar
scmoritz committed

scmoritz's avatar
scmoritz committed

  output: {
    path: `${__dirname}/dist`, // `dist` is the destination
    filename: 'bundle.js',
  },
scmoritz's avatar
scmoritz committed

  // To run development server
  devServer: {
    contentBase: __dirname,
    publicPath: '/dist',
    compress: true,
    port: 9000,
    hot: true,
    index: 'index.html',
  },
scmoritz's avatar
scmoritz committed

  module: {
    rules: [
      {
        test: /\.js$/, // Check for all js files
        exclude: /node_modules/,
        use: [{
          loader: 'babel-loader',
          options: { presets: ['env'] },
        }],
      },
    ],
  },
scmoritz's avatar
scmoritz committed

  devtool: 'eval-source-map', // Default development sourcemap
scmoritz's avatar
scmoritz committed
};