@vcmap/plugin-cli 4.1.5 → 4.1.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcmap/plugin-cli",
3
- "version": "4.1.5",
3
+ "version": "4.1.6",
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/build.js CHANGED
@@ -58,6 +58,9 @@ export default async function buildModule(options) {
58
58
  esbuild: {
59
59
  minify: !options.development,
60
60
  },
61
+ define: {
62
+ 'process.env.NODE_ENV': '"production"',
63
+ },
61
64
  build: {
62
65
  write: false,
63
66
  emptyOutDir: false,
@@ -30,6 +30,7 @@ export const promiseExec = util.promisify(childProcess.exec);
30
30
  * @typedef {PreviewOptions} VcmConfigJs
31
31
  * @property {Object} [proxy] - see https://vitejs.dev/config/server-options.html#server-proxy. when building a staging app, we try to deduce an .htaccess from it.
32
32
  * @property {string} [htaccess] - a string representing an .htaccess file content for use in staging apps.
33
+ * @property {Object} [optimizeDeps] - see https://vite.dev/config/dep-optimization-options
33
34
  */
34
35
 
35
36
  /**
package/src/serve.js CHANGED
@@ -130,6 +130,7 @@ export default async function serve(options) {
130
130
  '@vcmap-cesium/engine',
131
131
  'vue',
132
132
  'geographiclib-geodesic',
133
+ ...(mergedOptions.optimizeDeps?.include || []),
133
134
  ];
134
135
 
135
136
  // We exclude ui dependencies from optimization, to allow plugins to use another version of the same plugin.
@@ -139,9 +140,10 @@ export default async function serve(options) {
139
140
  (await readFile(uiPackageJsonPath)).toString(),
140
141
  );
141
142
 
142
- const excludedOptimizations = Object.keys(dependencies).filter(
143
- (name) => !optimizationIncludes.includes(name),
144
- );
143
+ const excludedOptimizations = [
144
+ ...Object.keys(dependencies),
145
+ ...(mergedOptions.optimizeDeps?.exclude || []),
146
+ ].filter((name) => !optimizationIncludes.includes(name));
145
147
 
146
148
  let serverFsConfig;
147
149
  const coreModule = join(process.cwd(), 'node_modules', '@vcmap', 'core');
@@ -175,6 +177,7 @@ export default async function serve(options) {
175
177
  preserveSymlinks: uiLStat.isSymbolicLink(),
176
178
  },
177
179
  optimizeDeps: {
180
+ ...(mergedOptions.optimizeDeps || {}),
178
181
  exclude: [
179
182
  '@vcmap/ui',
180
183
  '@vcmap/core',