marko-js-archive / marko-starter

MIT License
30 stars 8 forks source link

marko-starter build static resources without JS/CSS/others #15

Open ironsweet opened 7 years ago

ironsweet commented 7 years ago

Steps to produce: (I have "yarn" and "serve" pre-installed.)

marko create test
cd test
yarn build
serve dist

Open the browser, expect to see the demo. But instead, only HTML without CSS/JS/images.

However, if I run marko-starter build without NODE_ENV=production, everything works just fine.

roja commented 7 years ago

any news on resolving this bug?

to reproduce follow:

marko create project
cd project
NODE_ENV=production marko-starter build

at this point the dist folder is in a reasonable state then:

NODE_ENV=production marko-starter build

this causes all js and css files to be removed leaving a broken build.

if the .cache folder is deleted and the command is run again i.e.

rm -rf .cache
NODE_ENV=production marko-starter build

then the dist folder once again contains a valid build

patrick-steele-idem commented 7 years ago

I wouldn't expect JS and CSS files to be removed just by running NODE_ENV=production marko-starter build (there is no code to delete files in Lasso). Are you sure that that you are not deleting the Lasso output directory somehow?

Deleting .cache/ is probably a good workaround for now if you are seeing issues in your setup. We should probably invalidate the cache if the target dist directory for Lasso does not exist. In production, what we want to avoid is having to check files inside the dist directory to know if we need to do the build or not so we are completely relying on the cache. Currently, when in non-development mode, if if the cache says that the build has been done already then we assume that the previously generated files are there. We enter production mode if the NODE_ENV environment variable is set to anything other than `development.

We will be triaging issues this week and will investigate some more.

ravihara commented 6 years ago

I'm facing the same issue with respect to static build.

adrfall commented 5 years ago

I'm facing the same issue with respect to static build.

Same on windows and macos