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-client": "NODE_ENV=production webpack --config webpack.client.js -p --progress",
"build-server": "NODE_ENV=production webpack --config webpack.server.js -p --progress", "build-server": "NODE_ENV=production webpack --config webpack.server.js -p --progress",
"start": "NODE_ENV=production node ./build/server.js", "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": [ "keywords": [
"porfolio", "porfolio",
@ -49,7 +49,6 @@
"babel-eslint": "^10.0.1", "babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"babel-plugin-css-modules-transform": "^1.6.2", "babel-plugin-css-modules-transform": "^1.6.2",
"clean-webpack-plugin": "^3.0.0",
"compression-webpack-plugin": "^3.0.0", "compression-webpack-plugin": "^3.0.0",
"create-file-webpack": "^1.0.2", "create-file-webpack": "^1.0.2",
"css-loader": "^3.2.0", "css-loader": "^3.2.0",
@ -72,6 +71,7 @@
"uglifyjs-webpack-plugin": "^2.1.3", "uglifyjs-webpack-plugin": "^2.1.3",
"url-loader": "^2.1.0", "url-loader": "^2.1.0",
"webpack": "^4.7.0", "webpack": "^4.7.0",
"webpack-cleanup-plugin": "^0.5.1",
"webpack-cli": "^3.3.4", "webpack-cli": "^3.3.4",
"webpack-dev-middleware": "^3.1.3", "webpack-dev-middleware": "^3.1.3",
"webpack-hot-middleware": "^2.18.0", "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 { resolve } = require('path')
const webpack = require('webpack')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin') const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin')
const CompressionPlugin = require('compression-webpack-plugin') const CompressionPlugin = require('compression-webpack-plugin')
const ManifestPlugin = require('webpack-manifest-plugin') const ManifestPlugin = require('webpack-manifest-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin') const WebpackCleanupPlugin = require('webpack-cleanup-plugin')
const browserConfig = { const browserConfig = {
mode: 'production',
entry: { entry: {
bundle: [ bundle: [
'./src/app-client.js' './src/app-client.js'
@ -26,7 +24,7 @@ const browserConfig = {
use: [ use: [
'babel-loader' 'babel-loader'
], ],
exclude: '/node_modules/' include: resolve(__dirname, 'src')
}, },
{ {
test: /\.scss$/, test: /\.scss$/,
@ -67,8 +65,7 @@ const browserConfig = {
}, },
plugins: [ plugins: [
new ManifestPlugin(), new ManifestPlugin(),
new webpack.DefinePlugin({ __isBrowser__: 'true' }), new WebpackCleanupPlugin(),
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({ filename: '[name].[contenthash].css' }), new MiniCssExtractPlugin({ filename: '[name].[contenthash].css' }),
new CompressionPlugin({}) new CompressionPlugin({})
], ],

View File

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

2698
yarn.lock

File diff suppressed because it is too large Load Diff