-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.common.js
59 lines (57 loc) · 1.67 KB
/
webpack.common.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
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPartialsPlugin = require('html-webpack-partials-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const DotEnvPlugin = require('dotenv-webpack');
module.exports = {
entry: [
path.resolve(__dirname, 'src/index.ts'),
path.resolve(__dirname, 'src/assets/scss/index.scss')
],
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].[contenthash].js',
clean: true
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
include: [path.resolve(__dirname, 'src')]
}
]
},
plugins: [
new HtmlWebpackPlugin({
title: 'Modern Art Gallery',
template: path.resolve(__dirname, 'src/index.html'),
filename: 'index.html'
}),
new HtmlWebpackPlugin({
title: 'Modern Art Gallery: Location',
template: path.resolve(__dirname, 'src/location.html'),
filename: 'location.html'
}),
new HtmlWebpackPlugin({
title: 'Modern Art Gallery: Design System',
template: path.resolve(__dirname, 'src/design-system.html'),
filename: 'design-system.html'
}),
new HtmlWebpackPartialsPlugin({
path: path.join(__dirname, 'src/partials/footer.html'),
location: 'footer',
template_filename: ['index.html', 'location.html', 'design-system.html']
}),
new MiniCssExtractPlugin({
filename: 'assets/css/[name].[contenthash].css'
}),
new DotEnvPlugin({
systemvars: true
})
],
resolve: {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
extensions: ['.ts', '.js', '.json']
}
};