-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.conf.base.js
64 lines (63 loc) · 1.66 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
64
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const project = require('./project.json');
const env = process.env.NODE_ENV || 'development';
module.exports = {
entry: [`${__dirname}/${project.scripts.source.entry}`],
module: {
rules: [
{
test: /\.html$/,
include: [`${__dirname}/${project.scripts.source.root}`],
use: 'html-loader'
},
{
test: /\.css$/,
use: [ MiniCssExtractPlugin.loader, 'css-loader' ]
},
{
test: /\.styl$/,
use: [ MiniCssExtractPlugin.loader, 'css-loader', 'stylus-loader' ]
},
{
test: /\.js$/,
exclude: /node_modules/,
use: 'babel-loader'
},
{
test: /\.woff2(\?v=.*)?$/,
use: [
{
loader: 'file-loader',
options: {
name: project.fonts.dist.name,
outputPath: project.fonts.dist.root
}
}
]
}
]
},
resolve: {
alias: {
'@vue$': 'vue/dist/vue.esm.js',
'@environment$': `${__dirname}/${project.environments.source.root}/${env}.js`,
'@scripts': `${__dirname}/${project.scripts.source.root}`,
'@styles': `${__dirname}/${project.styles.source.root}`
}
},
plugins: [
new HtmlWebpackPlugin({
template: project.index.source.file,
minify: {
collapseWhitespace: true
}
}),
new CopyWebpackPlugin([{
from: project.images.source.files,
to: project.images.dist.root
}])
]
}