@marko/vite 4.0.2 → 4.0.4

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 -3
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -313,12 +313,16 @@ function esbuildPlugin(compiler, config) {
313
313
  const virtualFiles2 = /* @__PURE__ */ new Map();
314
314
  const finalConfig = {
315
315
  ...config,
316
- output: isScan ? "hydrate" : platform === "browser" ? "dom" : "html",
316
+ output: platform === "browser" ? "dom" : "html",
317
317
  resolveVirtualDependency(from, dep) {
318
318
  virtualFiles2.set(path2.join(from, "..", dep.virtualPath), dep);
319
319
  return dep.virtualPath;
320
320
  }
321
321
  };
322
+ const scanConfig = {
323
+ ...finalConfig,
324
+ output: "hydrate"
325
+ };
322
326
  build.onResolve({ filter: /\.marko\./ }, (args) => {
323
327
  return {
324
328
  namespace: "marko:virtual",
@@ -337,7 +341,7 @@ function esbuildPlugin(compiler, config) {
337
341
  try {
338
342
  const { code, meta } = await compiler.compileFile(
339
343
  args.path,
340
- finalConfig
344
+ isScan && args.namespace === "" ? scanConfig : finalConfig
341
345
  );
342
346
  return {
343
347
  loader: "js",
@@ -658,15 +662,21 @@ function markoPlugin(opts = {}) {
658
662
  enforce: "pre",
659
663
  // Must be pre to allow us to resolve assets before vite.
660
664
  async config(config, env) {
665
+ let optimize = env.mode === "production";
666
+ if ("MARKO_DEBUG" in process.env) {
667
+ optimize = process.env.MARKO_DEBUG === "false" || process.env.MARKO_DEBUG === "0";
668
+ } else {
669
+ process.env.MARKO_DEBUG = optimize ? "false" : "true";
670
+ }
661
671
  compiler ??= await import(opts.compiler || "@marko/compiler");
662
672
  runtimeId = opts.runtimeId;
663
673
  basePathVar = opts.basePathVar;
664
674
  baseConfig = {
665
675
  cache,
676
+ optimize,
666
677
  runtimeId,
667
678
  sourceMaps: true,
668
679
  writeVersionComment: false,
669
- optimize: env.mode === "production",
670
680
  babelConfig: opts.babelConfig ? {
671
681
  ...opts.babelConfig,
672
682
  caller: opts.babelConfig.caller ? {
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.0.2",
4
+ "version": "4.0.4",
5
5
  "author": "Dylan Piercey <dpiercey@ebay.com>",
6
6
  "bugs": "https://github.com/marko-js/vite/issues",
7
7
  "dependencies": {