Created
November 21, 2018 11:27
-
-
Save gentoid/7c0d8a7b439e48d2f4b38e1b1f4ec016 to your computer and use it in GitHub Desktop.
Configs from https://www.valentinog.com/blog/webpack-tutorial/
This file contains 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" | |
] | |
} |
This file contains 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": "webpac4-quickstart", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"build": "webpack --mode production", | |
"dev": "webpack --mode development", | |
"start": "webpack-dev-server --mode development --open", | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"@babel/core": "^7.1.6", | |
"@babel/preset-env": "^7.1.6", | |
"@babel/preset-react": "^7.0.0", | |
"babel-loader": "^8.0.4", | |
"css-loader": "^1.0.1", | |
"html-loader": "^0.5.5", | |
"html-webpack-plugin": "^3.2.0", | |
"mini-css-extract-plugin": "^0.4.4", | |
"react": "^16.6.3", | |
"react-dom": "^16.6.3", | |
"webpack": "^4.26.0", | |
"webpack-cli": "^3.1.2", | |
"webpack-dev-server": "^3.1.10" | |
} | |
} |
This file contains 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 HtmlWebPackPlugin = require('html-webpack-plugin') | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin') | |
module.exports = { | |
module: { | |
rules: [ | |
{ | |
test: /\.(js|jsx)$/, | |
exclude: /node_modules/, | |
use: { | |
loader: "babel-loader", | |
}, | |
}, | |
{ | |
test: /\.html$/, | |
use: { | |
loader: 'html-loader', | |
options: { minimize: true } | |
}, | |
}, | |
{ | |
test: /\.css$/, | |
use: [MiniCssExtractPlugin.loader, "css-loader"], | |
}, | |
], | |
}, | |
plugins: [ | |
new HtmlWebPackPlugin({ | |
template: './src/index.html', | |
filename: './index.html', | |
}), | |
new MiniCssExtractPlugin({ | |
filename: "[name].css", | |
chunkFilename: "[id].css", | |
}), | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment