Stencil version:
@stencil/[email protected]
I'm submitting a:
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/
Current behavior:
The app works well while using stencil build --serve --dev --watch, but once I build a production version, run a http server on the www folder and open it in the browser, it gets stuck on white screen on 50% of builds. On console I could see error 404, some resources were missing.
Expected behavior:
Production builds should work reliably.
Steps to reproduce:
Create a "Starter app" template and run npm start and npm run build a few times. After each production build, try to open on browser using some http server.
In my case I could see that index.html loads the first hashed js file successfully, but then it try to import 2 non-existing files.
Please note that this may not be related to the hash of file names, because I could reproduce this behavior with hashFileNames: false . In this case, it was importing a file with different content hash.
I can confirm that issue. It is also not related to caching (both in browser and cli "--no-cache" setting).
@MarkChrisLevy that's correct. I also tryied to use enableCache: false and still get the same error.
Just got this again today:

I have to build at least two times to make this work.
I'm having the same Problem since v2. Opened another issue couple weeks ago: #2671.
I can still reproduce this with 2.1.0
i can also reproduce this on 2.2.0.
if I delete the build directory, a new build works. only if there is already a build in the directory does not work.
I am still able to reproduce this with 2.3.0
@adamdbradley ,
I'm sorry to speak to you directly, but the error is really annoying, having to constantly delete the build folder in a running project. in version 1 it worked great.
you can reproduce this with the starter app
npm init stencil
npm i
npm run build => built index.html still has the app.css and app.js files in the head
npm run build => built index.html has compiled references except the nomodule one
so a second build produces different results
if you delete www, build will give your the first result again
Can reproduce the error in stencil 2.3.0
Always getting 404's for bundle file inside www
A temp fix is to delete the dist and www folders before running the build command. e.g
npm install --save-dev del-cli
package.json:
"build": "del-cli --force ./www && del-cli --force ./dist && stencil build --prod",
Most helpful comment
i can also reproduce this on 2.2.0.
if I delete the build directory, a new build works. only if there is already a build in the directory does not work.