-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
48 lines (47 loc) · 1.13 KB
/
webpack.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
import path from 'path';
export default {
// Fichier d'entrée :
entry: './client/src/main.js',
// Fichier de sortie :
output: {
path: path.resolve(process.cwd(), './client/public/build'),
filename: 'main.bundle.js',
publicPath: '/build/',
},
// compatibilité anciens navigateurs (si besoin du support de IE11 ou android 4.4)
target: ['web', 'es5'],
// connexion webpack <-> babel :
module: {
rules: [
{
test: /\.(ts|js)$/, // tous les fichiers js ou ts ...
exclude: /node_modules/, // ... sauf le dossier node_modules ...
use: {
// ... seront compilés par tsc !
loader: 'ts-loader',
options: {
configFile: 'tsconfig.client.json',
},
},
type: 'javascript/esm',
},
],
},
resolve: {
// Ajoute le support de l'extension `.ts`
extensions: ['.ts', '.js'],
},
devtool: 'source-map',
devServer: {
hot: false, // désactivation hot-reload (inutilisé)
static: {
directory: './client/public', // racine du serveur http
watch: {
// optimisation live-reload
ignored: 'node_modules',
},
},
port: 8000,
historyApiFallback: true, // gestion deeplinking
},
};