Skip to content

Instantly share code, notes, and snippets.

@og24715
Last active December 25, 2018 05:39
Show Gist options
  • Save og24715/f6441acdc0dbd6af61f6374f3f7cd550 to your computer and use it in GitHub Desktop.
Save og24715/f6441acdc0dbd6af61f6374f3f7cd550 to your computer and use it in GitHub Desktop.
React + Webpack (+ Chrome Extension) 最小構成

og24715/ABRepeatForYouTube を作るに当たり create-react-app を使わずに React アプリ作るのどうやったっけ、なったので Webpack を使った最小構成をちまちま書く。

$ yarn add react react-dom
$ yarn add -D babel @babel/core @babel/preset-env @babel/preset-react @babel/preset-stage-0 babel-loader webpack webpack-command
const path = require('path');

module.exports = {
  entry: {
    watch: './src/content/watch',
  },
  mode: 'development',
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        options: { presets: ['env', 'stage-0', 'react'] },
      },
    ],
  },
  resolve: { extensions: ['*', '.js', '.jsx'] },
  output: {
    path: path.resolve(__dirname, 'dist/'),
    filename: '[name].bundle.js',
  },
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment