marko-js / marko

A declarative, HTML-based language that makes building web apps fun
https://markojs.com/
MIT License
13.28k stars 641 forks source link

Subsequent builds only build .html files #945

Closed romanoff closed 3 years ago

romanoff commented 6 years ago

Bug Report

Marko Version: 4.7.1

Details

After initial creation of hello-world application, npm run-script build works as expected. But subsequent npm run-script builds only create .html files.

Expected Behavior

.js and .css files should be created as well as result of npm run-script build

Actual Behavior

Only .html files are created

Possible Fix

Not sure. Might be some caching problem.

Additional Info ### Your Environment Node 8.7.0 Ubuntu 16.04 ### Steps to Reproduce 1. marko create hello-world 2. cd hello-world 3. npm run-script build 4. rm -rf dist 5. npm run-script build ### Stack Trace ``` npm install marko-cli --global marko create hello-world aromanov@aromanov-ThinkCentre-M82:~/Programming/html/hello-world$ npm run-script build > hello-world@1.0.0 build /home/aromanov/Programming/html/hello-world > NODE_ENV=production marko-starter build [marko-starter plugins] Installed plugin: lasso [marko-starter marko-starter-demo] Building... [marko-starter marko-starter-demo] CONFIGURATION: name: marko-starter-demo routePathPrefix: / version: 0.0.0 dir: /home/aromanov/Programming/html/hello-world buildNumber: 0 colors: true minify: (not set) minifyCss: (not set) minifyJs: (not set) fingerPrintsEnabled: (not set) production: true flags: (not set) outputDir: /home/aromanov/Programming/html/hello-world/dist staticUrlPrefix: / plugins: (not set) lassoConfig: (not set) [marko-starter marko-starter-demo lasso] Configured default lasso [marko-starter marko-starter-demo] Building / to /home/aromanov/Programming/html/hello-world/dist/index.html... [marko-starter marko-starter-demo] Building page /... [marko-starter marko-starter-demo] Building /hello/marko to /home/aromanov/Programming/html/hello-world/dist/hello/marko/index.html... [marko-starter marko-starter-demo] Building page /hello/marko... [marko-starter marko-starter-demo] Building /hello/world to /home/aromanov/Programming/html/hello-world/dist/hello/world/index.html... [marko-starter marko-starter-demo] Building page /hello/world... [marko-starter marko-starter-demo] Building /hello/routing to /home/aromanov/Programming/html/hello-world/dist/hello/routing/index.html... [marko-starter marko-starter-demo] Building page /hello/routing... [marko-starter marko-starter-demo] Building /layouts to /home/aromanov/Programming/html/hello-world/dist/layouts/index.html... [marko-starter marko-starter-demo] Building page /layouts... [marko-starter marko-starter-demo] Finished building page /layouts Unable to minify the following code for [commonjs-def: path="/hello-world$1.0.0/src/routes/hello/components/stop-watch/index.marko"] at line 20 column 39: ------------------------------------ $_mod.def("/hello-world$1.0.0/src/routes/hello/components/stop-watch/index.marko", function(require, exports, module, __filename, __dirname) { // Compiled using marko@4.7.1 - DO NOT EDIT "use strict"; var marko_template = module.exports = require('/marko$4.7.1/dist/vdom'/*"marko/dist/vdom"*/).t(), marko_component = ({ onCreate: function () { this.state = { running: false, elapsedTime: 0 }; this.intervalId = null; }, onDestroy: function () { if (this.state.running) { clearInterval(this.intervalId); } }, handleStartClick: function () { this.state.running = true; this.intervalId = setInterval(() => { this.state.elapsedTime += 0.1; }, 100); }, handlePauseClick: function () { clearInterval(this.intervalId); this.state.running = false; }, handleStopClick: function () { clearInterval(this.intervalId); this.state.running = false; this.state.elapsedTime = 0; } }), components_helpers = require('/marko$4.7.1/dist/components/helpers-browser'/*"marko/dist/components/helpers"*/), marko_registerComponent = components_helpers.rc, marko_componentType = marko_registerComponent("/hello-world$1.0.0/src/routes/hello/components/stop-watch/index.marko", function() { return module.exports; }), marko_renderer = components_helpers.r, marko_defineComponent = components_helpers.c; function render(input, out, __component, component, state) { var data = input; out.e("DIV", null, "0", component, 4) .e("P", null, "1", component, 3) .t("Elapsed time: ") .t(state.elapsedTime.toFixed(1)) .t("s") .e("BUTTON", { type: "button", disabled: state.running === true }, "2", component, 1, 0, { onclick: __component.d("handleStartClick") }) .t("Start") .e("BUTTON", { type: "button", disabled: state.running !== true }, "3", component, 1, 0, { onclick: __component.d("handlePauseClick") }) .t("Pause") .e("BUTTON", { type: "button", disabled: (state.elapsedTime === 0) && (state.running === false) }, "4", component, 1, 0, { onclick: __component.d("handleStopClick") }) .t("Stop/Clear"); } marko_template._ = marko_renderer(render, { _l_: marko_componentType }, marko_component); marko_template.Component = marko_defineComponent(marko_component, marko_template._); }); ------------------------------------ [marko-starter marko-starter-demo] Finished building page /hello/world [marko-starter marko-starter-demo] Finished building page /hello/routing [marko-starter marko-starter-demo] Finished building page /hello/marko [marko-starter marko-starter-demo] Finished building page / [marko-starter marko-starter-demo] Build complete aromanov@aromanov-ThinkCentre-M82:~/Programming/html/hello-world$ rm -rf dist/ aromanov@aromanov-ThinkCentre-M82:~/Programming/html/hello-world$ npm run-script build > hello-world@1.0.0 build /home/aromanov/Programming/html/hello-world > NODE_ENV=production marko-starter build [marko-starter plugins] Installed plugin: lasso [marko-starter marko-starter-demo] Building... [marko-starter marko-starter-demo] CONFIGURATION: name: marko-starter-demo routePathPrefix: / version: 0.0.0 dir: /home/aromanov/Programming/html/hello-world buildNumber: 0 colors: true minify: (not set) minifyCss: (not set) minifyJs: (not set) fingerPrintsEnabled: (not set) production: true flags: (not set) outputDir: /home/aromanov/Programming/html/hello-world/dist staticUrlPrefix: / plugins: (not set) lassoConfig: (not set) [marko-starter marko-starter-demo lasso] Configured default lasso [marko-starter marko-starter-demo] Building / to /home/aromanov/Programming/html/hello-world/dist/index.html... [marko-starter marko-starter-demo] Building page /... [marko-starter marko-starter-demo] Building /hello/marko to /home/aromanov/Programming/html/hello-world/dist/hello/marko/index.html... [marko-starter marko-starter-demo] Building page /hello/marko... [marko-starter marko-starter-demo] Building /hello/world to /home/aromanov/Programming/html/hello-world/dist/hello/world/index.html... [marko-starter marko-starter-demo] Building page /hello/world... [marko-starter marko-starter-demo] Building /hello/routing to /home/aromanov/Programming/html/hello-world/dist/hello/routing/index.html... [marko-starter marko-starter-demo] Building page /hello/routing... [marko-starter marko-starter-demo] Building /layouts to /home/aromanov/Programming/html/hello-world/dist/layouts/index.html... [marko-starter marko-starter-demo] Building page /layouts... [marko-starter marko-starter-demo] Finished building page / [marko-starter marko-starter-demo] Finished building page /hello/marko [marko-starter marko-starter-demo] Finished building page /hello/world [marko-starter marko-starter-demo] Finished building page /hello/routing [marko-starter marko-starter-demo] Finished building page /layouts [marko-starter marko-starter-demo] Build complete ```
DylanPiercey commented 6 years ago

Hey @romanoff thanks for creating an issue. Would you be able to include the contents of the build command and some more information about your Marko setup/config? Are you using Marko starter?

romanoff commented 6 years ago

Just changed formatting in my issue description. There I provided output of commands that I used. I used "Create new apps" section in https://markojs.com/docs/installing/ so I assume I used Marko starter. First command was npm install marko-cli --global

romanoff commented 6 years ago

I was looking into it more and it turned that if I remove .cache folder (that is in .gitignore by default) then build happens the same way as first time

romanoff commented 6 years ago

One more thing: if I try to server content of dist folder (npm run-script serve-static which in turn does NODE_ENV=production marko-starter serve-static), then javascript functionality doesn't work (both click-counter doesn't increase counter and timer on routes page doesn't work)

romanoff commented 6 years ago

I reverted to marko version 4.2.8 (changed in package.json) and I have exactly same problem with cache, but at least it builds javascript code that works. Do you have CI? (I am not trying being sarcastic here. I really like the project and want it to succeed)

maxmilton commented 6 years ago

For the time being I've just modified my npm scripts to rm -rf .cache which is fine for production builds.

retrohacker commented 4 years ago

I'm running into this as well. Can confirm, removing .cache solve this. Adding this to the package.json forces the full build:

{
  "scripts": {
     "prebuild": "rm -rf .cache"
  }
}
DylanPiercey commented 3 years ago

This issue is lasso specific (.cache is from lasso). Also, the modern cli commands use webpack under the hood and do not have this issue.