@vcmap/plugin-cli 2.1.14 → 2.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/serve.js +25 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/plugin-cli",
3
- "version": "2.1.14",
3
+ "version": "2.1.15",
4
4
  "description": "A CLI to help develop and build plugins for the VC Map",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/serve.js CHANGED
@@ -107,6 +107,24 @@ export default async function serve(options) {
107
107
  const proxy = await getProxy(mergedOptions.https ? 'https' : 'http', port);
108
108
  const { peerDependencies } = await getPackageJson();
109
109
 
110
+ const optimizationIncludes = [
111
+ 'fast-deep-equal',
112
+ 'rbush',
113
+ 'rbush-knn',
114
+ 'pbf',
115
+ 'semver',
116
+ '@vcmap-cesium/engine',
117
+ 'vue',
118
+ ];
119
+
120
+ // We exclude ui dependencies from optimization, to allow plugins to use another version of the same plugin.
121
+ // vitejs seems to have a problem with optimized deps in different versions.
122
+ const { dependencies } = await getPackageJson(resolveMapUi([]));
123
+
124
+ const excludedOptimizations = Object.keys(dependencies).filter(
125
+ (name) => !optimizationIncludes.includes(name),
126
+ );
127
+
110
128
  const server = await createServer({
111
129
  root: getContext(),
112
130
  publicDir: './node_modules/@vcmap/ui/public',
@@ -118,16 +136,14 @@ export default async function serve(options) {
118
136
  dedupe: Object.keys(peerDependencies),
119
137
  },
120
138
  optimizeDeps: {
121
- exclude: ['@vcmap/ui', '@vcmap/core', 'ol', 'proj4'],
122
- include: [
123
- 'fast-deep-equal',
124
- 'rbush',
125
- 'rbush-knn',
126
- 'pbf',
127
- 'semver',
128
- '@vcmap-cesium/engine',
129
- 'vue',
139
+ exclude: [
140
+ '@vcmap/ui',
141
+ '@vcmap/core',
142
+ 'ol',
143
+ 'proj4',
144
+ ...excludedOptimizations,
130
145
  ],
146
+ include: optimizationIncludes,
131
147
  },
132
148
  plugins: [vue2(), createConfigJsonReloadPlugin()],
133
149
  server: {