-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
54 lines (53 loc) · 1.55 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
49
50
51
52
53
54
// Call to path to identify a value
const path = require('path')
// Import the html webpack plugin
const HtmlWebpackPlugin = require('html-webpack-plugin')
// Create the object to configure my webpack file
module.exports = {
// main file of my webapp
entry: './src/index.js',
// Where to save the information before to compile or go to production
output: {
// Use path to locate the path on dist (distribution)
path: path.resolve(__dirname, 'dist'),
// Compilation's name
filename: 'bundle.js'
},
// Extensions resolve
resolve: {
// Array of extensions
extensions: ['*', '.mjs', '.js', '.svelte']
},
// Settings and rules of my project
module: {
// Array of rules, to detect loaders or working with my loaders
rules: [
// First rule to working with babel loader
{
// RegExp
test: /\.js?$/,
// Exclude node_modules
exclude: /node_modules/,
use: {
loader:'babel-loader'
}
},
// Another rules to work with Svelte
{
test: /\.svelte?$/,
exclude: /node_modules/,
use: {
loader: 'svelte-loader'
}
}
]
},
// Add installed plugins
plugins: [
new HtmlWebpackPlugin({
inject: true,
template: './public/index.html',
filename: './index.html'
})
]
}