Skip to content

Commit 7e1614f

Browse files
committed
Re-add removed dependencies, but only copy them when available
1 parent 8968c45 commit 7e1614f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

vite.config.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,32 @@ const addNodeModulesToDist = () => {
4141
async writeBundle() {
4242
const toCopy = [
4343
['./node_modules/ol', './dist/node_modules/ol'],
44+
['./node_modules/color-rgba', './dist/node_modules/color-rgba'],
45+
['./node_modules/color-parse', './dist/node_modules/color-parse'],
46+
['./node_modules/color-name', './dist/node_modules/color-name'],
47+
['./node_modules/color-space', './dist/node_modules/color-space'],
4448
['./node_modules/rbush', './dist/node_modules/rbush'],
4549
['./node_modules/quickselect', './dist/node_modules/quickselect'],
4650
['./node_modules/earcut', './dist/node_modules/earcut'],
4751
// also copy the import map script
4852
['./cases/create-importmap.js', './dist/cases/create-importmap.js'],
4953
];
5054
await Promise.all(
51-
toCopy.map(([src, dest]) =>
55+
toCopy.map(([src, dest]) => {
56+
if (!existsSync(src)) {
57+
return;
58+
}
5259
fs.cp(src, dest, {
5360
recursive: true,
54-
})
55-
)
61+
});
62+
})
5663
);
5764

5865
// tweak color-name default export
5966
const colorNamePath = './dist/node_modules/color-name/index.js';
67+
if (!existsSync(colorNamePath)) {
68+
return;
69+
}
6070
const colorName = await fs.readFile(
6171
'./dist/node_modules/color-name/index.js',
6272
'utf-8'
@@ -71,6 +81,7 @@ const addNodeModulesToDist = () => {
7181

7282
// list of supported OL versions and current one
7383
const SUPPORTED_OL_VERSIONS = [
84+
'10.4.0',
7485
'10.3.1',
7586
'10.3.0',
7687
'10.2.1',

0 commit comments

Comments
 (0)