-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.js
59 lines (57 loc) · 1.69 KB
/
webpack.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
// eslint-disable-next-line import/no-extraneous-dependencies
import path from 'path';
export default {
// Resolve extensions and aliases
resolve: {
modules: [path.join(import.meta.url, 'src'), 'node_modules'],
extensions: ['*', '.js', '.jsx', '.css', '.ts', '.tsx'],
},
module: {
// The "use" property array is run from right to left.
rules: [
{
test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource',
},
{
test: /\.(woff|woff2|eot|ttf)$/,
use: [{
loader: 'url-loader',
options: {
limit: 10000,
name: './font/[hash].[ext]',
mimetype: 'application/font-woff',
},
}],
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
// Load and compile TS with TSC and transpile with babel
use: [
{
loader: 'babel-loader',
},
{
loader: 'ts-loader',
},
],
},
],
},
output: {
path: path.resolve('dist'),
publicPath: '/',
// Output as ES6 module
module: true,
libraryTarget: 'module',
environment: {
// The environment supports ECMAScript Module syntax to import ECMAScript modules (import ... from '...').
module: true,
},
},
// Output as ES6 module
experiments: {
outputModule: true,
},
};