-
Notifications
You must be signed in to change notification settings - Fork 0
/
tsdx.config.js
46 lines (43 loc) · 1.24 KB
/
tsdx.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
const postcss = require("rollup-plugin-postcss");
const svgr = require("@svgr/rollup");
const url = require("@rollup/plugin-url");
const copy = require("rollup-plugin-copy");
module.exports = {
// This function will run for each entry/format/env combination
rollup(config, options) {
config.plugins.push(
postcss({
config: {
path: "./postcss.config.js",
},
extensions: [".css", ".scss"],
minimize: true,
inject: {
insertAt: "top",
},
}),
);
config.plugins.push(svgr({ icon: true }));
config.plugins.push(
url({
limit: 0, // Always emit files as separate assets
include: ["**/illustrations/*.svg"], // You can adjust the pattern to match other images if needed
fileName: "assets/[name][extname]",
// publicPath: '/static/', // Adjust the public path as needed
}),
);
config.plugins.push(
copy({
targets: [{ src: "src/fonts/*", dest: "dist/fonts" }],
hook: "writeBundle", // ensure the copy is done at the end of bundling process
}),
);
// Add the image plugin
// config.plugins.push(
// img({
// limit: 10000, // Limit for data URLs. Files larger than this will be imported as file URLs.
// })
// );
return config; // always return a config.
},
};