-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.client.config.js
55 lines (48 loc) · 1.45 KB
/
webpack.client.config.js
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
/*
* Creates "client-bundle.js" for the client containing just the Vue App.
*
* This is created so that event handlers coded in JavaScript are available on the client browser.
*/
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.base.config.js');
const config = {
// do not need a 'target' as this is for the browser
// tell WebPack the root file of our client application
entry: {
app: [
'./src/client/main.js',
],
},
// tell WebPack the name of the generated output file and where to put it
output: {
filename: 'client-bundle.js',
path: path.resolve(__dirname, 'public'),
},
module: {
rules: [
// handle loading of css files
{
test: /\.css$/,
use: ['vue-style-loader','css-loader'],
},
],
},
// For bundle renderer source map support
// SourceMaps are used to map code in a compressed/minified file back to the original file
devtool: '#eval-source-map',
plugins: [
// copy anything from the src/public folder into the built public folder
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'src', 'public-assets'),
to: path.resolve(__dirname, 'public'),
},
],
}),
],
};
// merge the base config and this config together to produce the full server config
module.exports = merge(baseConfig, config);