@marko/vite 5.1.0 → 5.1.2

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 +18 -7
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1098,7 +1098,7 @@ function markoPlugin(opts = {}) {
1098
1098
  }
1099
1099
  }
1100
1100
  },
1101
- async buildStart(inputOptions) {
1101
+ async options(inputOptions) {
1102
1102
  if (isBuild && linked && !isSSRBuild) {
1103
1103
  try {
1104
1104
  serverManifest = await store.read();
@@ -1108,12 +1108,6 @@ function markoPlugin(opts = {}) {
1108
1108
  entryIds.add(id);
1109
1109
  cachedSources.set(id, serverManifest.entrySources[entry]);
1110
1110
  }
1111
- for (const assetId of serverManifest.ssrAssetIds) {
1112
- this.load({
1113
- id: normalizePath(path6.resolve(root, assetId)),
1114
- resolveDependencies: false
1115
- }).catch(noop2);
1116
- }
1117
1111
  } catch (err) {
1118
1112
  this.error(
1119
1113
  `You must run the "ssr" build before the "browser" build.`
@@ -1124,6 +1118,16 @@ function markoPlugin(opts = {}) {
1124
1118
  }
1125
1119
  }
1126
1120
  },
1121
+ async buildStart() {
1122
+ if (isBuild && linked && !isSSRBuild) {
1123
+ for (const assetId of serverManifest.ssrAssetIds) {
1124
+ this.load({
1125
+ id: normalizePath(path6.resolve(root, assetId)),
1126
+ resolveDependencies: false
1127
+ }).catch(noop2);
1128
+ }
1129
+ }
1130
+ },
1127
1131
  async resolveId(importee, importer, importOpts, ssr = importOpts.ssr) {
1128
1132
  if (virtualFiles.has(importee)) {
1129
1133
  return importee;
@@ -1332,6 +1336,13 @@ if (import.meta.hot) import.meta.hot.accept(() => {});`;
1332
1336
  apply: "build",
1333
1337
  enforce: "post",
1334
1338
  // We use a "post" plugin to allow us to read the final generated `.html` from vite.
1339
+ transform(_source, id, opts2) {
1340
+ if (!opts2?.ssr && /\.module\.[^.]+(?:\?|$)/.test(id)) {
1341
+ return {
1342
+ moduleSideEffects: "no-treeshake"
1343
+ };
1344
+ }
1345
+ },
1335
1346
  async generateBundle(outputOptions, bundle, isWrite) {
1336
1347
  if (!linked) {
1337
1348
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/vite",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "A Marko plugin for Vite",
5
5
  "keywords": [
6
6
  "loader",