-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.conf.base.js
63 lines (61 loc) · 1.62 KB
/
webpack.conf.base.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
56
57
58
59
60
61
62
63
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const project = require('./project.json');
const env = process.env.NODE_ENV || 'development';
module.exports = {
entry: [`${__dirname}/${project.scripts.source.entry}`],
output: {
filename: project.scripts.dist.filename[env],
assetModuleFilename: project.images.dist.filename[env]
},
module: {
rules: [
{
test: /\.html$/,
include: [`${__dirname}/${project.scripts.source.root}`],
loader: 'html-loader',
options: {
minimize: false
}
},
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
},
{
test: /\.styl$/,
use: [ 'style-loader', 'css-loader', 'stylus-loader' ]
},
{
test: /\.(jpg|jpeg|png|svg)/,
type: 'asset'
},
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
}
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.common.prod.js',
'@environment$': `${__dirname}/${project.environments.source.root}/${env}.js`,
'@images': `${__dirname}/${project.images.source.root}`,
'@scripts': `${__dirname}/${project.scripts.source.root}`,
'@styles': `${__dirname}/${project.styles.source.root}`,
}
},
plugins: [
new HtmlWebpackPlugin({
template: project.index.source.file
}),
new CopyWebpackPlugin({
patterns: [{
from: project.images.source.files,
to: `${project.images.dist.root}/[name][ext]`
}]
})
]
}