stencil icon indicating copy to clipboard operation
stencil copied to clipboard

Error: The glob pattern import("./**/*.entry.js*") did not match any files [empty-glob]bug:

Open benjaminmilcic opened this issue 1 year ago • 25 comments

Prerequisites

Stencil Version

dont know

Current Behavior

-1

In my Angular Project, when i do ng build, the build is canceled and i got:

▲ [WARNING] The glob pattern import("./**/.entry.js") did not match any files [empty-glob]

node_modules/@stencil/core/internal/client/index.js:3808:2:
  3808 │   `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVers...
       ╵   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ng serve works well.

Has anyone an idea what that means?

Expected Behavior

i expect that the build do not cancel.

System Info

"npx stencil info" gives me:

 Build: 1708962986
     Stencil: 4.12.4
  TypeScript: 5.3.3
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.27.2

Steps to Reproduce

i do not know

Code Reproduction URL

i do not know

Additional Information

No response

benjaminmilcic avatar Mar 03 '24 16:03 benjaminmilcic

@benjaminmilcic thanks for raising the issue.

It would be great if you could provide a bit more information to help us reproduce the case. Is your project using Stencil components from an NPM module or are you using Stencil components directly. This error message alone won't help us to start any investigations.

christian-bromann avatar Mar 03 '24 20:03 christian-bromann

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Stencil starter component library and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

ionitron-bot[bot] avatar Mar 03 '24 20:03 ionitron-bot[bot]

I don`t use Stencil directly. I never worked with it directly. I think it is used by Ionic.

Here is my package.json

{ "name": "aznw-routes", "version": "0.0.0", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "watch": "ng build --watch --configuration development", "test": "ng test" }, "private": true, "dependencies": { "@angular/animations": "^17.1.0", "@angular/cdk": "^17.2.1", "@angular/common": "^17.1.0", "@angular/compiler": "^17.1.0", "@angular/core": "^17.1.0", "@angular/forms": "^17.1.0", "@angular/google-maps": "^17.2.1", "@angular/material": "^17.2.1", "@angular/platform-browser": "^17.1.0", "@angular/platform-browser-dynamic": "^17.1.0", "@angular/router": "^17.1.0", "@ionic/angular": "^7.7.3", "@ngx-translate/core": "^15.0.0", "@ngx-translate/http-loader": "^8.0.0", "@tinymce/tinymce-angular": "^7.0.0", "angular-resizable-element": "^7.0.2", "feiertagejs": "^1.4.0", "ng2-tooltip-directive": "^2.10.3", "ngx-toastr": "^18.0.0", "rxjs": "~7.8.0", "tslib": "^2.3.0", "zone.js": "~0.14.3" }, "devDependencies": { "@angular-devkit/build-angular": "^17.1.2", "@angular/cli": "^17.1.2", "@angular/compiler-cli": "^17.1.0", "@types/jasmine": "~5.1.0", "jasmine-core": "~5.1.0", "karma": "~6.4.0", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.0", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", "tailwindcss": "^3.4.1", "typescript": "~5.3.2" } }

ng build worked before. Then I changed it to use angular routes and I added angular material and ionic. I remember that I also installated the pagage " postcss-import" and removed it again. ng serve worked well all the time. Then i made ng build and it breaks.

Here is my tsconfig.js

/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "forceConsistentCasingInFileNames": true, "strict": false, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "skipLibCheck": true, "esModuleInterop": true, "sourceMap": true, "declaration": false, "experimentalDecorators": true, "moduleResolution": "node", "importHelpers": true, "target": "ES2022", "module": "ES2022", "useDefineForClassFields": false, "lib": [ "ES2022", "dom" ] }, "angularCompilerOptions": { "enableI18nLegacyMessageIdFormat": false, "strictInjectionParameters": true, "strictInputAccessModifiers": true, "strictTemplates": false } }

Shall I provide other files here, like package-lock.json or so?

benjaminmilcic avatar Mar 04 '24 06:03 benjaminmilcic

Hello @benjaminmilcic, this looks like it might be the same issue as #5389 which was fixed in Stencil v4.12.4. Ionic Framework, however, is currently using Stencil v4.12.3, so I think that may have to do with why you're seeing the error.

To help us confirm that, could you provide a minimal reproduction case which showcases the issue? We aren't able to do much to help diagnose the issue without one. A minimal reproduction would be a git repository which includes the simplest project which showcases the problem, and will let us diagnose the issue and then test out a fix.

alicewriteswrongs avatar Mar 04 '24 14:03 alicewriteswrongs

Ok, here are steps to reproduce:

  1. ng new (name: test) (style sheets: css) (no SSR)
  2. ng add @ionic/angular
  3. ng build

ng version gives me:

Angular CLI: 17.2.2 Node: 20.11.0 Package Manager: npm 10.2.4 OS: win32 x64

Angular: 17.2.3 ... animations, common, compiler, compiler-cli, core, forms ... platform-browser, platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.1702.2 @angular-devkit/build-angular 17.2.2 @angular-devkit/core 17.2.2 @angular-devkit/schematics 17.2.2 @angular/cli 17.2.2 @schematics/angular 17.2.2 rxjs 7.8.1 typescript 5.3.3 zone.js 0.14.4

ionic version gives me: 7.2.0

And here is a GitHub-Repo: [(https://github.com/benjaminmilcic/ionic-stencil-error)]

Thanks a lot for the time to try helping...

benjaminmilcic avatar Mar 04 '24 16:03 benjaminmilcic

I was able to clone the reproduction and saw the following warning in the build step:

▲ [WARNING] The glob pattern import("./**/*.entry.js*") did not match any files [empty-glob]

    node_modules/@stencil/core/internal/client/index.js:3808:2:
      3808 │   `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVers...
           ╵   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think this warning can be ignored however we should identify if @ionic/angular uses Stencils lazy components or DCE (dist-custom-elements) and if not, ensure this part of stencil is not imported anywhere.

@benjaminmilcic we have ingested the issue into our backlog and will at it eventually. I unfortunately can't give you a timeline at this point but will make sure to post updates as we have it.

christian-bromann avatar Mar 04 '24 18:03 christian-bromann

Can I ask you how I can make ng build with ignoring the warning and not break the build?

benjaminmilcic avatar Mar 04 '24 20:03 benjaminmilcic

Thanks for rasing this issue. Experiencing the same problem, too.

papastepano avatar Mar 23 '24 09:03 papastepano

experiencing the same problem, too.

moh4sa avatar Apr 01 '24 21:04 moh4sa

Is there a temporary fix coming for this issue or even better a permanent fix. It's a bit weird to build a app for production with these kinds of warnings in them even though they are harmless. Thanks!

VerburgtJimmy avatar Apr 02 '24 06:04 VerburgtJimmy

Hey folks, we don't have a timeline at the moment. Please upvote this issue using the 👍 reaction on the summary of the issue to help us get better visibility into its severity

rwaskiewicz avatar Apr 03 '24 19:04 rwaskiewicz

experiencing the same problem with node 18, too.

WhippyM avatar Apr 04 '24 06:04 WhippyM

Tengo exactamente el mismo problema tambien

JavierValdez avatar Apr 06 '24 05:04 JavierValdez

I could not reproduce the "build cancelled". I have one project of my own running latest Ionic & Angular. I have cloned the repro. In both cases I have the build output. I do get the warning, but usually, they can be disregarded. The build is still generated. image image

Perhaps, it has something to do with the Node version. Usually, if I have build problems it's because the Node version is incompatible with Angular somehow.

image

gultyayev avatar Apr 09 '24 11:04 gultyayev

i'm experiencing this problem too

Angular CLI: 17.3.0 Node: 20.11.1 Package Manager: npm 10.2.4 OS: win32 x64

Angular: 17.3.0 ... animations, cdk, cli, common, compiler, compiler-cli, core ... forms, material, platform-browser, platform-browser-dynamic ... router

Package Version

@angular-devkit/architect 0.1703.0 @angular-devkit/build-angular 17.3.0 @angular-devkit/core 17.3.0 @angular-devkit/schematics 17.3.0 @schematics/angular 17.3.0 rxjs 7.8.1 typescript 5.4.2 zone.js 0.14.4

claudiotrenca avatar Apr 11 '24 14:04 claudiotrenca

@WhippyM @claudiotrenca can you elaborate what problem you are experiencing? I can confirm what @gultyayev is observing which is that a warning is being thrown but can be disregarded.

christian-bromann avatar Apr 15 '24 15:04 christian-bromann

I also face this issue. I don't have any private info, so I can share it. I can't ionic build, ionic cap sync ios.

@christian-bromann here is repo https://github.com/HaidarVladyslav/ionic-report-glob-import

Please let me know if it's internal issue or just on my side - but according to current discussion it seems few people also face same issue. Hope it helps, thank you!

HaidarVladyslav avatar Apr 15 '24 17:04 HaidarVladyslav

@WhippyM @claudiotrenca can you elaborate what problem you are experiencing? I can confirm what @gultyayev is observing which is that a warning is being thrown but can be disregarded.

It seems like it was another mistake. It is only a warning. But it's confusing.

WhippyM avatar Apr 15 '24 17:04 WhippyM

@HaidarVladyslav it's not clear from your post what error you are facing, as the "error" in the topic is not an error, but a warning, and does not prevent builds, normally.

What issues I see when I cloned your repo:

  1. There is no CLI installed in the project. The error clearly complains about that. Which I have fixed for my local install.

  2. The build passes successfully, but cap sync phase fails. And again, it has a clear error message image

    It's fixed easily by changing the folder in the capacitor.config.ts

  3. Next thing, for my personal env, is that I didn't run XCode after updates, and it couldn't run it before I opened it and installed iOS. + went to the location in Xcode to fix, as per https://stackoverflow.com/questions/17980759/xcode-select-active-developer-directory-error image

  4. Another problem, the CocoaPods is missing which is again mentioned in the logs which can be seen on the screenshot above, but now it's a warning.

Now, the build passes image

Also, I had to remove the IOS folder, and add the platform again, because my Xcode ran into some permission errors. Which I would guess could be a result of some sudo command or something. After platform was re-added – everything was built successfully in Xcode.

image

All I did is – read error messages, and fixed them.

gultyayev avatar Apr 15 '24 17:04 gultyayev

@forrestlin2020 can you provide a minimal reproducible example?

At this point all we can do is to better document the warning from the compiler and that it can be ignored. If someone can provide anything reproducible that has a bigger user impact please share an example with us.

christian-bromann avatar Apr 15 '24 21:04 christian-bromann

After changed back to @angular-devkit/build-angular:browser (Webpack), "ng build" works well.

What is the error you get? Any chance it's same as in the item 2 here?

If so, then you need to adjust your capacitor config. That's the only substantial difference between the old and the new builder. One more folder nesting level in the build output.

gultyayev avatar Apr 16 '24 11:04 gultyayev

@forrestlin2020 it's not an error. It says "warning" in the logs. Look for "error" wording. Or, for red words. If you post the whole console output from the command input till the very end – this would help figuring what is wrong there.

You can also try Ctrl+F to search for "error" if the log is too big.

gultyayev avatar Apr 16 '24 11:04 gultyayev

@forrestlin2020 I asked for the whole output. This piece that you have posted is not helpful to understand what problem you are facing.

Given the lack of information I can blindly guess that if you change your capacitor.config.ts so that it has webDir: 'www/browser',. And you return your application builder back in angular.json – everything would work.

gultyayev avatar Apr 16 '24 11:04 gultyayev

This warning also occurs for me, but only when using esbuild with the following configuration:

angular.json
{
  "executor": "@angular-devkit/build-angular:application"
}
import type { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'io.ionic.starter',
  appName: 'ionic0417',
  webDir: 'www/browser'
};

export default config;

sohibegit avatar Apr 24 '24 13:04 sohibegit

This same issue also can be replicated with the wc-datepicker package depending on stencil.

Replication instructions:

$ mkdir stencil-test && cd stencil-test
$ npm init -y && npm i wc-datepicker && npm i -D esbuild
$ echo 'import { WcDatepicker } from "wc-datepicker/dist/components/wc-datepicker";' > index.js
$ ./node_modules/.bin/esbuild index.js --bundle

ahukkanen avatar Apr 26 '24 16:04 ahukkanen

Also experiencing this during serve

woutersteven avatar May 23 '24 22:05 woutersteven

This is still an issue. What is Stencil and why is it needed?

Kaddtechnologies avatar Jun 17 '24 00:06 Kaddtechnologies

Hey folks 👋 I will go ahead and close this issue as there doesn't seem to be anything actionable for us anymore. We have documented that this warning is expected and can be ignored.

Note: if you are using lazy loaded components, there is no way around this dynamic import. If you are using a compiler like Esbuild or Vite you are better off compiling Stencil components using the dist-custom-element output target, import that bundle instead and have your compiler do the tree shaking work.

If you are using an external Stencil component, check if they compile and publish a dist-custom-element atrifact as well and if not raise an issue.

You can find more information about the differences between lazy and standalone components in the Stencil docs. If you have further questions, join our Discord channel! Thank you!

christian-bromann avatar Jun 25 '24 19:06 christian-bromann