-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
37 lines (35 loc) · 1.25 KB
/
webpack.config.js
File metadata and controls
37 lines (35 loc) · 1.25 KB
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
const { resolve, join } = require('path');
module.exports = {
//-------------------------------------------
// webpack dev server needs mode set, to work
//-------------------------------------------
mode: 'development',
//--------------------------------------------
devtool: 'eval-source-map', // Note 2: eval-source map is for development mode debugging through browser
entry: './src/index.ts',
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
include: [resolve(__dirname, 'src')],
},
],
},
resolve: {
extensions: ['.ts', '.js'], // Note 1: This helps typescript to resolve import statements/syntax at the top of a .ts file.
},
output: {
// publicPath: 'dist', // commented out because using this didn't work for dev server. Fix(es) have been added towards the end of this file.
filename: 'bundle.js',
path: resolve(__dirname, 'dist'),
},
//--------------------------------------------
// Tiny fix to solve "cannot get /" in browser
//--------------------------------------------
devServer: {
static: {
directory: join(__dirname, 'dist'),
},
},
};