Last active
March 6, 2020 03:32
-
-
Save wildfrontend/b466bb2d4b1e30a86e9f32a9f7da1c93 to your computer and use it in GitHub Desktop.
react basic project webpack
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": "", | |
"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" | |
} |
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') | |
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