@file-viewer/vite-plugin 2.1.13 → 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.
- package/dist/index.js +29 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -384,6 +384,22 @@ const presetModules = {
|
|
|
384
384
|
chunkName: 'file-viewer-preset-engineering'
|
|
385
385
|
}
|
|
386
386
|
};
|
|
387
|
+
// Vite dep optimization rewrites import.meta.url into node_modules/.vite/deps,
|
|
388
|
+
// which breaks package-local worker URLs such as @file-viewer/pptx.
|
|
389
|
+
const workerUrlSensitivePackages = [
|
|
390
|
+
'@file-viewer/pptx',
|
|
391
|
+
'@file-viewer/renderer-presentation',
|
|
392
|
+
'@file-viewer/preset-all',
|
|
393
|
+
'@file-viewer/preset-office',
|
|
394
|
+
'@file-viewer/react-full',
|
|
395
|
+
'@file-viewer/react-legacy-full',
|
|
396
|
+
'@file-viewer/vue3-full',
|
|
397
|
+
'@file-viewer/vue2.7-full',
|
|
398
|
+
'@file-viewer/vue2.6-full',
|
|
399
|
+
'@file-viewer/web-full',
|
|
400
|
+
'@file-viewer/jquery-full',
|
|
401
|
+
'@file-viewer/svelte-full'
|
|
402
|
+
];
|
|
387
403
|
const defaultScanRoots = ['src', 'app', 'pages', 'components'];
|
|
388
404
|
const defaultScanExtensions = [
|
|
389
405
|
'js',
|
|
@@ -669,6 +685,12 @@ function hasManualChunks(config) {
|
|
|
669
685
|
}
|
|
670
686
|
return Boolean(output?.manualChunks);
|
|
671
687
|
}
|
|
688
|
+
function createOptimizeDepsExclude(config) {
|
|
689
|
+
return unique([
|
|
690
|
+
...(config.optimizeDeps?.exclude || []),
|
|
691
|
+
...workerUrlSensitivePackages
|
|
692
|
+
]);
|
|
693
|
+
}
|
|
672
694
|
function createManualChunks(selection, autoPresetIds = []) {
|
|
673
695
|
const packageToChunk = new Map();
|
|
674
696
|
const presetIds = unique([
|
|
@@ -977,10 +999,16 @@ export function fileViewerRenderers(options = {}) {
|
|
|
977
999
|
config(userConfig) {
|
|
978
1000
|
const projectRoot = resolve(process.cwd(), userConfig.root || '.');
|
|
979
1001
|
refreshSelection(projectRoot);
|
|
1002
|
+
const nextConfig = {
|
|
1003
|
+
optimizeDeps: {
|
|
1004
|
+
exclude: createOptimizeDepsExclude(userConfig)
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
980
1007
|
if ((options.chunkStrategy || 'renderer') === 'none' || hasManualChunks(userConfig)) {
|
|
981
|
-
return
|
|
1008
|
+
return nextConfig;
|
|
982
1009
|
}
|
|
983
1010
|
return {
|
|
1011
|
+
...nextConfig,
|
|
984
1012
|
build: {
|
|
985
1013
|
rollupOptions: {
|
|
986
1014
|
output: {
|
package/package.json
CHANGED