StencilJs does not generate app-global and index files in production build

589 views Asked by At

I am trying to generate a production build in StencilJs using the command "npm run build". One of the generated js files in www build folder has imports of index-0e699d98.js and app-globals-320636ef.js. But these files are not present anywhere in the build folder. This in turn is leading to 404 errors when we are deploying the production build.

Both of these files, however, are present in the www folder when I'm taking a dev build, i.e, by running "npm start".

The file that imports the file which in turn has both of the above mentioned imports is included as a script tag in the index.html file in the build folder.

 <link rel="modulepreload" href="/build/p-a5903422.js">
     <script type="module" src="/build/p-a5903422.js" data-stencil data-resources-url="/build/"
       data-stencil-namespace="tax-engine"></script>

(The p-a5903422.js file has another js file import which in turn imports the index-0e699d98.js and app-globals-320636ef.js)

Is anything going wrong during the build or do I need to set some Config properties so that I can get index-0e699d98.js and app-globals-320636ef.js in production build?

1

There are 1 answers

0
Anto On

I too have been facing this same issue and the only reliable way to get it working is to execute npm run build twice.

This happens with recent version @stencil/[email protected]