Skip to content

Instantly share code, notes, and snippets.

@wildfrontend
Last active March 6, 2020 03:32
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 wildfrontend/b466bb2d4b1e30a86e9f32a9f7da1c93 to your computer and use it in GitHub Desktop.
Save wildfrontend/b466bb2d4b1e30a86e9f32a9f7da1c93 to your computer and use it in GitHub Desktop.
react basic project webpack
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.3",
"babel-loader": "^8.0.6",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
"webpack-dev-server": "^3.10.2"
},
"scripts": {
"start": "webpack-dev-server --open --mode development",
"build": "webpack --mode production"
},
"keywords": [],
"author": "",
"license": "ISC"
}
const path = require('path')
module.exports = {
entry: {
index: './src/index.js'
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader'
}
}
]
},
plugins: [],
devServer: {
contentBase: path.join(__dirname, 'public'),
compress: true,
port: 3000
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment