Last active
July 9, 2019 07:06
-
-
Save Frisch12/b272f9c3838b271939bada6533b4ab19 to your computer and use it in GitHub Desktop.
React webpack template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "presets": [ | |
| "@babel/preset-env", | |
| "@babel/preset-react" | |
| ], | |
| "plugins": [ | |
| "@babel/proposal-class-properties", | |
| "@babel/proposal-object-rest-spread" | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "app", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "index.js", | |
| "dependencies": { | |
| "axios": "^0.19.0", | |
| "prop-types": "^15.7.2", | |
| "react": "^16.8.6", | |
| "react-dom": "^16.8.6", | |
| "react-redux": "^7.1.0", | |
| "redux": "^4.0.1" | |
| }, | |
| "devDependencies": { | |
| "@babel/core": "^7.4.5", | |
| "@babel/plugin-proposal-class-properties": "^7.5.0", | |
| "@babel/plugin-proposal-object-rest-spread": "^7.5.1", | |
| "@babel/preset-env": "^7.4.5", | |
| "@babel/preset-react": "^7.0.0", | |
| "@babel/preset-typescript": "^7.3.3", | |
| "babel-loader": "^8.0.6", | |
| "css-loader": "^3.0.0", | |
| "html-loader": "^0.5.5", | |
| "html-webpack-plugin": "^3.2.0", | |
| "node-sass": "^4.12.0", | |
| "react-hot-loader": "^4.12.1", | |
| "sass-loader": "^7.1.0", | |
| "style-loader": "^0.23.1", | |
| "webpack": "^4.35.2", | |
| "webpack-cli": "^3.3.5", | |
| "webpack-dev-server": "^3.7.2" | |
| }, | |
| "scripts": { | |
| "start": "webpack-dev-server --open --mode development", | |
| "build": "webpack --mode production", | |
| "watch": "webpack --mode development --watch --progress --watch-poll" | |
| }, | |
| "author": "", | |
| "license": "MIT" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| const webpack = require('webpack'); | |
| const HtmlWebPackPlugin = require("html-webpack-plugin"); | |
| module.exports = { | |
| entry: { | |
| app: path.resolve(__dirname, 'src/app.jsx') | |
| }, | |
| module: { | |
| rules: [ | |
| { | |
| test: /\.(js|jsx)$/, | |
| exclude: /node_modules/, | |
| use: { | |
| loader: "babel-loader" | |
| } | |
| }, | |
| { | |
| test: /\.html$/, | |
| use: [ | |
| { | |
| loader: "html-loader" | |
| } | |
| ] | |
| }, | |
| { | |
| test: /\.scss$/, | |
| use: [{ | |
| loader: "style-loader" | |
| }, { | |
| loader: "css-loader" | |
| }, { | |
| loader: "sass-loader" | |
| }] | |
| } | |
| ] | |
| }, | |
| resolve: { | |
| extensions: ['*', '.js', '.jsx'] | |
| }, | |
| plugins: [ | |
| new HtmlWebPackPlugin({ | |
| template: path.resolve(__dirname, 'src/index.html'), | |
| filename: "index.html", | |
| chunks: ['app'] | |
| }), | |
| new webpack.HotModuleReplacementPlugin() | |
| ], | |
| watchOptions: { | |
| poll: true | |
| }, | |
| output: { | |
| path: path.resolve(__dirname, 'dist/'), | |
| publicPath: '/', | |
| filename: '[name].js' | |
| }, | |
| devServer: { | |
| watchContentBase: true, | |
| publicPath: '/', | |
| hot: true | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment