@marko/vite 4.1.7 → 4.1.9

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/dist/index.mjs +13 -8
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -833,6 +833,10 @@ function markoPlugin(opts = {}) {
833
833
  "Cannot use @marko/vite `basePathVar` with Vite's `renderBuiltUrl` option."
834
834
  );
835
835
  }
836
+ if (isSSRBuild && !config.build?.ssrEmitAssets) {
837
+ config.build ??= {};
838
+ config.build.assetsDir ??= "";
839
+ }
836
840
  const assetsDir = config.build?.assetsDir?.replace(/[/\\]$/, "") ?? "assets";
837
841
  const assetsDirLen = assetsDir.length;
838
842
  const assetsDirEnd = assetsDirLen + 1;
@@ -1081,7 +1085,11 @@ function markoPlugin(opts = {}) {
1081
1085
  if (!isBuild) {
1082
1086
  const ext = path5.extname(id);
1083
1087
  if (ext === ".cjs" || ext === ".js" && isCJSModule(id)) {
1084
- return cjsToEsm(source);
1088
+ try {
1089
+ return await cjsToEsm(source);
1090
+ } catch {
1091
+ return null;
1092
+ }
1085
1093
  }
1086
1094
  }
1087
1095
  return null;
@@ -1164,13 +1172,10 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1164
1172
  for (const fileName in bundle) {
1165
1173
  const chunk = bundle[fileName];
1166
1174
  if (chunk.type === "chunk") {
1167
- for (const id in chunk.modules) {
1168
- if (id.endsWith(serverEntryQuery)) {
1169
- serverManifest.chunksNeedingAssets.push(
1170
- path5.resolve(dir, fileName)
1171
- );
1172
- break;
1173
- }
1175
+ if (chunk.moduleIds.includes(renderAssetsRuntimeId)) {
1176
+ serverManifest.chunksNeedingAssets.push(
1177
+ path5.resolve(dir, fileName)
1178
+ );
1174
1179
  }
1175
1180
  }
1176
1181
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
3
  "description": "A Marko plugin for Vite",
4
- "version": "4.1.7",
4
+ "version": "4.1.9",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {