Guest User

Untitled

a guest
Dec 9th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // webpack.config.js
  2. const webpack = require("webpack");
  3. const path = require("path");
  4. const HtmlWebpackPlugin = require("html-webpack-plugin");
  5.  
  6. module.exports = {
  7.   mode: "development",
  8.   target: "web",
  9.   devtool: "cheap-module-source-map",
  10.   entry: "./src/index",
  11.   output: {
  12.     path: path.resolve(__dirname, "build"),
  13.     publicPath: "/",
  14.     filename: "bundle.js"
  15.   },
  16.   devServer: {
  17.     stats: "minimal",
  18.     overlay: true,
  19.     historyApiFallback: true,
  20.     disableHostCheck: true,
  21.     headers: { "Access-Control-Allow-Origin": "*" },
  22.     https: false
  23.   },
  24.   plugins: [
  25.     new HtmlWebpackPlugin({
  26.       template: "src/index.html",
  27.       favicon: "src/favicon.ico"
  28.     })
  29.   ],
  30.   module: {
  31.     rules: [
  32.       {
  33.         test: /\.(js|jsx)$/,
  34.         exclude: /node_modules/,
  35.         use: ["babel-loader", "eslint-loader"]
  36.       },
  37.       {
  38.         test: /(\.css)$/,
  39.         use: ["style-loader", "css-loader"]
  40.       }
  41.     ]
  42.   }
  43. };
  44.  
  45. // package.json
  46. {
  47.   "name": "react-custom",
  48.   "version": "1.0.0",
  49.   "description": "custom react env",
  50.   "main": "index.js",
  51.   "scripts": {
  52.     "start": "NODE_ENV=development webpack-dev-server --config webpack.config.js --port 3000"
  53.   },
  54.   "author": "Author Name",
  55.   "license": "MIT",
  56.   "devDependencies": {
  57.     "@babel/core": "^7.7.4",
  58.     "babel-eslint": "^10.0.3",
  59.     "babel-loader": "^8.0.6",
  60.     "babel-preset-react-app": "^9.0.2",
  61.     "css-loader": "^3.2.1",
  62.     "eslint": "^6.7.2",
  63.     "eslint-loader": "^3.0.2",
  64.     "eslint-plugin-import": "^2.18.2",
  65.     "eslint-plugin-react": "^7.17.0",
  66.     "html-webpack-plugin": "^3.2.0",
  67.     "style-loader": "^1.0.1",
  68.     "webpack": "^4.41.2",
  69.     "webpack-cli": "^3.3.10",
  70.     "webpack-dev-server": "^3.9.0"
  71.   },
  72.   "engines": {
  73.     "node": ">=8"
  74.   },
  75.   "dependencies": {
  76.     "react": "^16.12.0",
  77.     "react-dom": "^16.12.0"
  78.   }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment