Created
March 19, 2021 17:20
-
-
Save sefatanam/fffe38665dd46819261888dae1b15eb8 to your computer and use it in GitHub Desktop.
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 path = require('path'); | |
const TerserPLugin = require('terser-webpack-plugin'); | |
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | |
const CleanWebpackPlugin = require('clean-webpack-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin') | |
module.exports = { | |
entry: './src/index.js', | |
output: { | |
filename: 'bundle.[contenthash].js', | |
path: path.resolve(__dirname, './dist'), | |
publicPath: '' | |
}, | |
mode: "none", | |
module: { | |
rules: [ | |
{ | |
test: /\.(xml)$/, | |
use: ['xml-loader'] | |
}, | |
{ | |
test: /\.(.png|jpg|jfif)$/, | |
use: [ | |
'file-loader' | |
] | |
}, | |
{ | |
test: /\.css$/, | |
use: [ | |
MiniCssExtractPlugin.loader, 'css-loader' | |
] | |
}, | |
{ | |
test: /\.scss$/, | |
use: [ | |
MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader' | |
] | |
}, | |
{ | |
test: /\.js$/, | |
exclude: '/node_modules/', | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['@babel/env'], | |
plugins: ['transform-class-properties'] | |
} | |
} | |
}, | |
], | |
}, | |
plugins: [ | |
new CleanWebpackPlugin(), | |
new HtmlWebpackPlugin(), | |
new TerserPLugin(), | |
new MiniCssExtractPlugin({ | |
filename: 'style.[contenthash].css' | |
}), | |
] | |
} |
{
"name": "wpacktuts",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"css-loader": "^5.0.1",
"file-loader": "^6.2.0",
"node-sass": "^5.0.0",
"sass-loader": "^10.1.1",
"style-loader": "^2.0.0",
"webpack": "^5.18.0"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/preset-env": "^7.12.11",
"babel-loader": "^8.2.2",
"babel-plugin-transform-class-properties": "^6.24.1",
"clean-webpack-plugin": "^2.0.2",
"html-webpack-plugin": "^4.2.0",
"mini-css-extract-plugin": "^1.3.9",
"terser-webpack-plugin": "^5.1.1",
"webpack-cli": "^4.5.0"
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
set it to public