This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.dev.config.js
61 lines (58 loc) · 1.62 KB
/
webpack.dev.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
56
57
58
59
60
61
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/* eslint-disable @typescript-eslint/no-var-requires */
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackHarddiskPlugin = require('html-webpack-harddisk-plugin');
const path = require('path');
const dist = path.resolve(__dirname, 'dist');
module.exports = {
entry: './src/index.ts',
mode: 'development',
watch: true,
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
exclude: /node_modules/,
options: {
configFile: 'tsconfig.json',
},
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', 'sass-loader'],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js',
path: dist,
},
devServer: {
contentBase: dist,
compress: true,
port: 8080,
},
plugins: [
new CleanWebpackPlugin(),
new CopyWebpackPlugin([
{ from: 'assets', to: 'assets' },
]),
new HtmlWebpackPlugin({
title: 'Contoso Foods',
filename: 'index.html',
template: 'src/index.html',
alwaysWriteToDisk: true,
minify: false,
}),
new HtmlWebpackHarddiskPlugin({
outputPath: dist,
}),
],
};