Update webpack config

This commit is contained in:
LordMathis 2020-01-11 00:31:56 +01:00
parent c4bde27577
commit a5ad47a4d8
No known key found for this signature in database
GPG Key ID: 575849FD91CE470C
5 changed files with 1331 additions and 1400 deletions

View File

@ -8,7 +8,7 @@
"build-client": "NODE_ENV=production webpack --config webpack.client.js -p --progress",
"build-server": "NODE_ENV=production webpack --config webpack.server.js -p --progress",
"start": "NODE_ENV=production node ./build/server.js",
"start-dev": "NODE_ENV=development nodemon --exec babel-node ./src/server.js --ignore data.json"
"start-dev": "NODE_ENV=development nodemon --exec babel-node ./src/server.js"
},
"keywords": [
"porfolio",
@ -49,7 +49,6 @@
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-css-modules-transform": "^1.6.2",
"clean-webpack-plugin": "^3.0.0",
"compression-webpack-plugin": "^3.0.0",
"create-file-webpack": "^1.0.2",
"css-loader": "^3.2.0",
@ -72,6 +71,7 @@
"uglifyjs-webpack-plugin": "^2.1.3",
"url-loader": "^2.1.0",
"webpack": "^4.7.0",
"webpack-cleanup-plugin": "^0.5.1",
"webpack-cli": "^3.3.4",
"webpack-dev-middleware": "^3.1.3",
"webpack-hot-middleware": "^2.18.0",

View File

@ -1 +1,2 @@
module.exports = {}
module.exports = {
}

View File

@ -1,14 +1,12 @@
const { resolve } = require('path')
const webpack = require('webpack')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin')
const ManifestPlugin = require('webpack-manifest-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const WebpackCleanupPlugin = require('webpack-cleanup-plugin')
const browserConfig = {
mode: 'production',
entry: {
bundle: [
'./src/app-client.js'
@ -26,7 +24,7 @@ const browserConfig = {
use: [
'babel-loader'
],
exclude: '/node_modules/'
include: resolve(__dirname, 'src')
},
{
test: /\.scss$/,
@ -67,8 +65,7 @@ const browserConfig = {
},
plugins: [
new ManifestPlugin(),
new webpack.DefinePlugin({ __isBrowser__: 'true' }),
new CleanWebpackPlugin(),
new WebpackCleanupPlugin(),
new MiniCssExtractPlugin({ filename: '[name].[contenthash].css' }),
new CompressionPlugin({})
],

View File

@ -1,9 +1,7 @@
const { resolve } = require('path')
const webpack = require('webpack')
const nodeExternals = require('webpack-node-externals')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const CreateFileWebpack = require('create-file-webpack')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
const WebpackCleanupPlugin = require('webpack-cleanup-plugin')
const serverConfig = {
entry: './src/server.js',
@ -55,19 +53,8 @@ const serverConfig = {
]
},
plugins: [
new webpack.DefinePlugin({
__isBrowser__: 'false'
}),
new MiniCssExtractPlugin(),
new CleanWebpackPlugin(),
new CreateFileWebpack({
path: './',
fileName: 'data.json',
content: JSON.stringify({
'posts': [],
'other': {}
})
})
new WebpackCleanupPlugin()
]
}

2698
yarn.lock

File diff suppressed because it is too large Load Diff