Marko: Markojs Windows - rollup - paths

Created on 1 Aug 2017  路  8Comments  路  Source: marko-js/marko

Bug Report

When using server side rendering with Express and using in Windows, the compiled javascript for the template result in:
// Compiled using [email protected] - DO NOT EDIT "use strict";
var marko_template = module.exports = require("marko/src/html").t(__filename), marko_getCurrentComponent = require("marko/src/components/taglib/helpers/getCurrentComponent"), helpers_module = require("../../public/javascripts/helpers/helpers"), titleify = helpers_module.titleify, marko_forEachPropStatusVar = require("marko/src/runtime/helper-forEachPropStatusVar"), forEacPropStatusVar = marko_forEachPropStatusVar, marko_helpers = require("marko/src/runtime/html/helpers"), marko_escapeXml = marko_helpers.x, marko_escapeXmlAttr = marko_helpers.xa, marko_forEachProp = require("marko/src/runtime/helper-forEachProperty"), marko_attr = marko_helpers.a, marko_loadTag = marko_helpers.t, w_preserve_tag = marko_loadTag(require("marko/src/components\\taglib\\preserve-tag"));

`function render(input, out) {
var data = input;

var __component = marko_getCurrentComponent(out);

var __componentId1 = __component.elId("0[]");

w_preserve_tag({
id: __componentId1,
renderBody: function renderBody(out) {
out.w("");`

  forEacPropStatusVar(data, function(key, module, loop) {
    let paddingClass = 'pt-3'

    if (loop.isFirst()) {
      paddingClass = 'pt-2'
    }

    out.w("<div class=\"" +
      marko_escapeXmlAttr(paddingClass) +
      "\"><button data-toggle=\"collapse\" data-target=\"#collapse" +
      marko_escapeXmlAttr(key) +
      "\" type=\"button\" class=\"btn btn-default btn-block\">" +
      marko_escapeXml(titleify(key)) +
      "</button><div id=\"collapse" +
      marko_escapeXmlAttr(key) +
      "\" data-name=\"" +
      marko_escapeXmlAttr(key) +
      "\" class=\"collapse moduleCheckboxes\">");

    marko_forEachProp(module, function(pluginKey, plugin) {
      out.w("<label class=\"form-check-label d-block mt-2\"><input type=\"checkbox\" value=\"" +
        marko_escapeXmlAttr(pluginKey) +
        "\" id=\"" +
        marko_escapeXmlAttr(pluginKey) +
        "\">" +
        marko_escapeXml(titleify(pluginKey)) +
        "</label>");
    });

    out.w("</div></div>");
  });

  out.w("</div>");
}

}, out);
}`

marko_template._ = render;

marko_template.meta = { tags: [ "marko/src/components\\taglib\\preserve-tag" ] };


The important part, I think, is that the loadTag and template meta transforms with "\\". The console throws an error:
Error: Could not resolve 'marko/src/components aglibpreserve-tag' from E:\xampp\htdocs\project\project\views\formFields\index.marko

The include() is called within a structure:
./views/app/index.marko
./views/formFields/index.marko

The content of formFields/index.marko is:
`import { titleify } from '../../public/javascripts/helpers/helpers';

$ let paddingClass = 'pt-3' $ paddingClass = 'pt-2'
    </div>
</for>

`

Context

Everything works fine on Linux, MacOS. The problem which I don't understand is, that if I remove the include tags from the template, starts the app, everything is fine (elements are not there). Then on the runtime I insert the include tags back, it recompiles, it throws an error but the elements appear.

Possible Fix

Additional Info

Your Environment

  • Version used: 4.4.21
  • Environment name and version (e.g. Chrome 39, node.js 5.4): node v7.8.0
  • Operating System and version (desktop or mobile): Windows 8.1 (desktop)
  • Link to your project:

compiler bug

All 8 comments

Sorry, the code blocks just breaks

Same happens on my Windows 10 machine, Chrome 52, node 8.2.1. Exact same errors. Can you please ellaborate on how this can be fixed and if it can be fixed?

@kure- Are you using webpack?

@austinkelleher rollup it is in this case

Just an update. I have a fix for this and will be putting up a PR soon.

@austinkelleher great thank you :)

@kure- @VojtechKlos This issue is fixed in [email protected]. Thanks for the detailed report.

@austinkelleher you rock, thanks for the notice and update! Everything runs smoothly now ;)

Was this page helpful?
0 / 5 - 0 ratings