-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathwebpack.client.config.js
More file actions
58 lines (55 loc) · 1.47 KB
/
webpack.client.config.js
File metadata and controls
58 lines (55 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const path = require('path');
const webpack = require('webpack');
const HtmlInlineCSSWebpackPlugin = require("html-inline-css-webpack-plugin").default;
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebPackPlugin = require("html-webpack-plugin");
const CopyPlugin = require('copy-webpack-plugin');
const webpackMerge = require('webpack-merge');
const defaultConfig = require('./webpack.config');
const NODE_ENV = process.env.NODE_ENV || 'development';
module.exports = webpackMerge(defaultConfig, {
mode: NODE_ENV,
entry: path.resolve(__dirname, './src/app.client.js'),
output: {
filename: '[name].js',
path: path.resolve(__dirname, './docs'),
publicPath: NODE_ENV === 'development' ? '/' : '/ticketmaster',
},
devServer: {
port: 3000,
},
module: {
rules: [
{
test: /\.css$/,
exclude: /node_modules/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
'css-loader',
'postcss-loader'
],
},
],
},
plugins: [
new MiniCssExtractPlugin(),
new HtmlWebPackPlugin({
template: './src/index.html',
}),
new HtmlInlineCSSWebpackPlugin({
leaveCSSFile: false,
replace: {
removeTarget: true,
target: '<!-- inline_css_plugin -->',
},
}),
new CopyPlugin([
{ from: 'public' },
]),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
}),
],
});