-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathwebpack.dev.config.mjs
More file actions
94 lines (93 loc) · 2.12 KB
/
webpack.dev.config.mjs
File metadata and controls
94 lines (93 loc) · 2.12 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import HtmlWebpackPlugin from "html-webpack-plugin";
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
import webpack from "webpack";
export default [
{
mode: "development",
entry: ["./dev/index.ts"],
plugins: [
new HtmlWebpackPlugin({
template: "./dev/index.html",
inject: 'head'
}),
new NodePolyfillPlugin(),
new webpack.ProvidePlugin({
$rdf: 'rdflib',
SolidLogic: 'solid-logic',
UI: 'solid-ui'
}),
new webpack.DefinePlugin({
'global': 'globalThis',
'process.env.NODE_ENV': JSON.stringify('development')
})
],
module: {
rules: [
{
test: /\.(js|ts)$/,
exclude: /node_modules/,
use: ["babel-loader"],
},
{
test: /\.ttl$/, // Target text files
type: 'asset/source', // Load the file's content as a string
},
{
test: /\.css$/,
exclude: /\.module\.css$/,
use: ['style-loader', 'css-loader'],
},
{
test: /\.module\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true
}
}
]
}
],
},
externals: {
'rdflib': '$rdf',
'solid-logic': 'SolidLogic',
'solid-ui': 'UI'
},
resolve: {
extensions: [".js", ".ts"],
alias: {
$rdf: 'rdflib',
rdflib: 'rdflib',
SolidLogic: 'solid-logic',
'solid-logic': 'solid-logic',
UI: 'solid-ui',
'solid-ui': 'solid-ui'
}
},
output: {
globalObject: 'globalThis',
library: {
type: 'umd',
umdNamedDefine: true
}
},
optimization: {
usedExports: true,
// Tree shaking in development (normally disabled for faster builds)
providedExports: true,
},
devServer: {
static: [
'./dev',
{
directory: './node_modules',
publicPath: '/node_modules'
}
],
},
devtool: "source-map",
},
];