Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: invalid import paths in app.js introduced with v4.19.0 #5882

Closed
3 tasks done
christian-bromann opened this issue Jul 4, 2024 · 8 comments · Fixed by #5943
Closed
3 tasks done

bug: invalid import paths in app.js introduced with v4.19.0 #5882

christian-bromann opened this issue Jul 4, 2024 · 8 comments · Fixed by #5943
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@christian-bromann
Copy link
Member

Prerequisites

Stencil Version

v4.19.0

Current Behavior

Starting this version I see the following imports in my app.js which don't resolve:

import { bootstrapLazy } from '../node_modules/@stencil/core/internal/client/index.js?app-data=conditional';
export { setNonce } from '../node_modules/@stencil/core/internal/client/index.js?app-data=conditional';
import { patchBrowser } from '../node_modules/@stencil/core/internal/client/patch-browser.js';
import { g as globalScripts } from './app-globals-6b09102a.js';

Expected Behavior

In v4.18.x the same compile step results in the following output:

import{p as o,b as t}from"./p-2b58b695.js";export{s as setNonce}from"./p-2b58b695.js";import{g as r}from"./p-fc662416.js";var p=()=>{const t=import.meta.url;const s={};if(t!==""){s.resourcesUrl=new URL(".",t).href}return o(s)};p().then((async o=>{await r();return t([["p-51f58157",[[1,"app-root",{count:[2],docsHint:[1,"docs-hint"]}]]]],o)}));
//# sourceMappingURL=app.esm.js.map

So there are two observations:

  • the imports became invalid
  • the code isn't minified

System Info

System: node 20.12.2
    Platform: darwin (22.6.0)
   CPU Model: Apple M2 Max (12 cpus)
    Compiler: /Users/christian.bromann/Sites/WebdriverIO/projects/electron-boilerplate/node_modules/@stencil/core/compiler/stencil.js
       Build: 1716921701
     Stencil: 4.18.3 😄
  TypeScript: 5.4.5
      Rollup: 2.56.3
      Parse5: 7.1.2
      jQuery: 4.0.0-pre
      Terser: 5.31.0

Steps to Reproduce

Run the following:

git clone git@github.com:webdriverio/electron-boilerplate.git
cd electron-boilerplate
npm i
npm run build

observe the output in dist. Then update the Stencil version to v4.18.3 and rebuild the project.

Code Reproduction URL

https://github.com/webdriverio/electron-boilerplate

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jul 4, 2024
@christian-bromann christian-bromann added Bug: Validated This PR or Issue is verified to be a bug within Stencil and removed triage labels Jul 4, 2024
@lucafoscili
Copy link

Hi, any update on this issue?
I think it may be connected to a compilation problem I'm experiencing with versions beyond 4.18.3, concerning ECharts types:

ketchup-lite: [04:39.1]  @stencil/core
ketchup-lite: [04:39.4]  v4.20.0
ketchup-lite: [04:41.0]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [04:41.1]  transpile started ...
ketchup-lite: [04:43.6]  transpile finished in 2.50 s
ketchup-lite: [ ERROR ]  TypeScript: src/components.d.ts:16:10
ketchup-lite:            Module '"echarts"' has no exported member 'XAXisOption'.
ketchup-lite:      L15:  import { KulChartEventPayload, KulChartLegendPlacement, KulChartType } from "./components/kul-chart/kul-chart-declarations";
ketchup-lite:      L16:  import { XAXisOption as XAXisComponentOption, YAXisOption as YAXisCom
ketchup-lite:      L17:  import { KulDataDataset as KulDataDataset1, KulDebugComponentInfo as KulDebugComponentInfo1 } from "./components";
ketchup-lite: [ ERROR ]  TypeScript: src/components.d.ts:16:47
ketchup-lite:            Module '"echarts"' has no exported member 'YAXisOption'.
ketchup-lite:      L15:  import { KulChartEventPayload, KulChartLegendPlacement, KulChartType } from "./components/kul-chart/kul-chart-declarations";
ketchup-lite:      L16:   { XAXisOption as XAXisComponentOption, YAXisOption as YAXisComponent
ketchup-lite:      L17:  import { KulDataDataset as KulDataDataset1, KulDebugComponentInfo as KulDebugComponentInfo1 } from "./components";
ketchup-lite: [04:43.6]  build failed in 2.64 s

Here is the compilation logs with 4.18.3:

ketchup-lite: [13:35.9]  @stencil/core
ketchup-lite: [13:36.1]  v4.18.3
ketchup-lite: [13:37.5]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [13:37.7]  transpile started ...
ketchup-lite: [13:40.2]  transpile finished in 2.50 s
ketchup-lite: [13:40.2]  copy started ...
ketchup-lite: [13:41.0]  generate custom elements started ...
ketchup-lite: [13:41.0]  generate lazy started ...
ketchup-lite: [13:43.1]  copy finished (3615 files) in 2.88 s
ketchup-lite: [13:56.0]  generate custom elements finished in 14.98 s
ketchup-lite: [14:02.3]  generate lazy finished in 21.30 s
ketchup-lite: [14:02.4]  generating react-library started ...
ketchup-lite: [14:02.4]  generate react-library finished in 7 ms
ketchup-lite: [14:02.9]  build finished in 25.32 s

These are how the imports causing the errors are defined in components.d.ts:

import { XAXisComponentOption, YAXisComponentOption } from "echarts";
// ...other imports...
export { XAXisComponentOption, YAXisComponentOption } from "echarts";

In case you need to investigate, this is the repo.

@christian-bromann
Copy link
Member Author

christian-bromann commented Aug 26, 2024

A fix for this bug has been published in Stencil v4.21.0!

@lucafoscili
Copy link

confirmed, thank you! :)

@lucafoscili
Copy link

lucafoscili commented Aug 28, 2024

Hey @christian-bromann , an update.

The first build worked fine:

ketchup-lite: [23:34.1]  @stencil/core
ketchup-lite: [23:34.7]  v4.21.0
ketchup-lite: [23:37.5]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [23:37.6]  transpile started ...
ketchup-lite: [23:39.4]  transpile finished in 1.81 s
ketchup-lite: [23:39.7]  generate custom elements + source maps started ...
ketchup-lite: [23:39.7]  generate lazy + source maps started ...
ketchup-lite: [23:48.6]  generate custom elements + source maps finished in 8.94 s
ketchup-lite: [23:53.6]  generate lazy + source maps finished in 13.85 s
ketchup-lite: [23:53.6]  copy started ...
ketchup-lite: [23:53.7]  generating react-output-target started ...
ketchup-lite: [23:54.2]  updated readme docs: kul-chart
ketchup-lite: [23:54.4]  generate react-output-target finished in 728 ms
ketchup-lite: [23:55.0]  copy finished (3615 files) in 1.48 s
ketchup-lite: [23:55.8]  build finished in 18.37 s

————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 

 Lerna (powered by Nx)   Successfully ran target build for project ketchup-lite

Building again the same sources, without changing any, triggers an error similar to before:

ketchup-lite: [26:11.1]  @stencil/core
ketchup-lite: [26:11.4]  v4.21.0
ketchup-lite: [26:12.7]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [26:12.8]  transpile started ...
ketchup-lite: [26:14.8]  transpile finished in 1.98 s
ketchup-lite: [ ERROR ]  TypeScript: src/components.d.ts:16:10
ketchup-lite:            Module '"echarts"' has no exported member 'XAXisOption'.
ketchup-lite:      L15:  import { KulChartEventPayload, KulChartLegendPlacement, KulChartType } from "./components/kul-chart/kul-chart-declarations";
ketchup-lite:      L16:  import { XAXisOption as XAXisComponentOption, YAXisOption as YAXisCom
ketchup-lite:      L17:  import { KulDataDataset as KulDataDataset1, KulDebugComponentInfo as KulDebugComponentInfo1 } from "./components";
ketchup-lite: [ ERROR ]  TypeScript: src/components.d.ts:16:47
ketchup-lite:            Module '"echarts"' has no exported member 'YAXisOption'.
ketchup-lite:      L15:  import { KulChartEventPayload, KulChartLegendPlacement, KulChartType } from "./components/kul-chart/kul-chart-declarations";
ketchup-lite:      L16:   { XAXisOption as XAXisComponentOption, YAXisOption as YAXisComponent
ketchup-lite:      L17:  import { KulDataDataset as KulDataDataset1, KulDebugComponentInfo as KulDebugComponentInfo1 } from "./components";
ketchup-lite: [26:14.8]  build failed in 2.10 s

Could it be or am I doing something wrong?
Thx!

Edit:
Building after manually deleting the components.d.ts file seemed to have worked fine:

ketchup-lite: [31:47.2]  @stencil/core
ketchup-lite: [31:47.5]  v4.21.0
ketchup-lite: [31:48.8]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [31:48.9]  transpile started ...
ketchup-lite: [31:50.6]  transpile finished in 1.75 s
ketchup-lite: [31:51.0]  generate custom elements + source maps started ...
ketchup-lite: [31:51.0]  generate lazy + source maps started ...
ketchup-lite: [31:59.6]  generate custom elements + source maps finished in 8.61 s
ketchup-lite: [32:02.3]  generate lazy + source maps finished in 11.29 s
ketchup-lite: [32:02.3]  copy started ...
ketchup-lite: [32:02.3]  generating react-output-target started ...
ketchup-lite: [32:02.9]  updated readme docs: kul-tree
ketchup-lite: [32:03.1]  generate react-output-target finished in 713 ms
ketchup-lite: [32:03.7]  copy finished (3615 files) in 1.42 s
ketchup-lite: [32:04.6]  build finished in 15.82 s

———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 

 Lerna (powered by Nx)   Successfully ran target build for project ketchup-lite

@christian-bromann
Copy link
Member Author

@lucafoscili can you verifying that this behavior repeats, e.g. first build passes, second build fails?

@lucafoscili
Copy link

Yep, just tried.
2 builds back to back after a clean install (only stencil/core was changed in the package.json).
The first build is successful, the second build fails.

Screenshot 2024-08-28 171439

Full log:

yarn install

(venv) C:\Users\Luca\Documents\GitHub\ketchup-lite>yarn install
➤ YN0000: ┌ Resolution step
➤ YN0061: │ @types/cypress@npm:1.1.3 is deprecated: This is a stub types definition for cypress (https://cypress.io). cypress provides its own type definitions, so you don't need @types/cypress installed!
➤ YN0061: │ @humanwhocodes/config-array@npm:0.11.14 is deprecated: Use @eslint/config-array instead
➤ YN0061: │ @humanwhocodes/object-schema@npm:2.0.3 is deprecated: Use @eslint/object-schema instead
➤ YN0061: │ rimraf@npm:3.0.2 is deprecated: Rimraf versions prior to v4 are no longer supported
➤ YN0061: │ glob@npm:7.2.3 is deprecated: Glob versions prior to v9 are no longer supported
➤ YN0061: │ inflight@npm:1.0.6 is deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
➤ YN0002: │ @nrwl/devkit@npm:19.6.3 doesn't provide nx (p943e2), requested by @nx/devkit
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 17s 903ms
➤ YN0000: ┌ Fetch step
➤ YN0019: │ validate-npm-package-name-npm-3.0.0-e44c263962-ce4c68207a.zip appears to be unused - removing
➤ YN0019: │ validate-npm-package-name-npm-5.0.0-fc061c1b84-5342a99498.zip appears to be unused - removing
➤ YN0019: │ vue-eslint-parser-npm-9.4.2-3e4e696025-67f14c8ea1.zip appears to be unused - removing
➤ YN0019: │ ws-npm-8.17.0-05fb441faf-147ef9eab0.zip appears to be unused - removing
➤ YN0019: │ zod-npm-3.22.4-2bccbc41b4-80bfd7f803.zip appears to be unused - removing
➤ YN0000: └ Completed in 1s 256ms
➤ YN0000: ┌ Link step
➤ YN0007: │ cypress@npm:13.14.0 must be built because it never has been before or the last one failed
➤ YN0007: │ puppeteer@npm:22.15.0 must be built because it never has been before or the last one failed
➤ YN0007: │ nx@npm:19.6.3 [b6dc6] must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 7s 211ms
➤ YN0000: Done with warnings in 26s 429ms

yarn build (first time)

(venv) C:\Users\Luca\Documents\GitHub\ketchup-lite>yarn build
(node:12444) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
lerna notice cli v8.1.8
lerna info versioning independent
lerna notice filter including "ketchup-lite"
lerna info filter [ 'ketchup-lite' ]

> ketchup-lite:build

(node:12444) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
ketchup-lite: [12:13.7]  @stencil/core
ketchup-lite: [12:14.0]  v4.21.0
ketchup-lite: [12:15.1]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [12:15.2]  transpile started ...
ketchup-lite: [12:17.0]  transpile finished in 1.83 s
ketchup-lite: [12:17.4]  generate custom elements + source maps started ...
ketchup-lite: [12:17.4]  generate lazy + source maps started ...
ketchup-lite: [12:28.8]  generate custom elements + source maps finished in 11.41 s
ketchup-lite: [12:31.4]  generate lazy + source maps finished in 14.05 s
ketchup-lite: [12:31.4]  copy started ...
ketchup-lite: [12:31.5]  generating react-library started ...
ketchup-lite: [12:31.5]  updated readme docs: kul-code
ketchup-lite: [12:31.7]  generate react-library finished in 178 ms
ketchup-lite: [12:32.3]  copy finished (3615 files) in 878 ms
ketchup-lite: [12:33.1]  build finished in 17.99 s

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 

 Lerna (powered by Nx)   Successfully ran target build for project ketchup-lite


(node:19752) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
lerna notice cli v8.1.8
lerna info versioning independent
lerna notice filter including "ketchup-lite-react"
lerna info filter [ 'ketchup-lite-react' ]

> ketchup-lite-react:build

(node:19752) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
ketchup-lite-react: > ketchup-lite-react@1.0.5 clean
ketchup-lite-react: > rimraf dist

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 

 Lerna (powered by Nx)   Successfully ran target build for project ketchup-lite-react



> ketchup-lite-root@1.0.0 doc
> node ./packages/ketchup-lite/src/scripts/doc.js

Documentation generated successfully.
File formatted and saved successfully.

yarn build (second time)

(venv) C:\Users\Luca\Documents\GitHub\ketchup-lite>yarn build
(node:3412) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
lerna notice cli v8.1.8
lerna info versioning independent
lerna notice filter including "ketchup-lite"
lerna info filter [ 'ketchup-lite' ]

> ketchup-lite:build

(node:3412) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
ketchup-lite: [12:46.2]  @stencil/core
ketchup-lite: [12:46.5]  v4.21.0
ketchup-lite: [12:47.6]  build, ketchup-lite, prod mode, started ...
ketchup-lite: [12:47.7]  transpile started ...
ketchup-lite: [12:49.7]  transpile finished in 2.01 s
ketchup-lite: [ ERROR ]  TypeScript: src/components.d.ts:16:10
ketchup-lite:            Module '"echarts"' has no exported member 'XAXisOption'.
ketchup-lite:      L15:  import { KulChartEventPayload, KulChartLegendPlacement, KulChartType } from "./components/kul-chart/kul-chart-declarations";       
ketchup-lite:      L16:  import { XAXisOption as XAXisComponentOption, YAXisOption as YAXisCom
ketchup-lite:      L17:  import { KulDataDataset as KulDataDataset1, KulDebugComponentInfo as KulDebugComponentInfo1 } from "./components";
ketchup-lite: [ ERROR ]  TypeScript: src/components.d.ts:16:47
ketchup-lite:            Module '"echarts"' has no exported member 'YAXisOption'.
ketchup-lite:      L15:  import { KulChartEventPayload, KulChartLegendPlacement, KulChartType } from "./components/kul-chart/kul-chart-declarations";       
ketchup-lite:      L16:   { XAXisOption as XAXisComponentOption, YAXisOption as YAXisComponent
ketchup-lite:      L17:  import { KulDataDataset as KulDataDataset1, KulDebugComponentInfo as KulDebugComponentInfo1 } from "./components";
ketchup-lite: [ ERROR ]  TypeScript: src/managers/kul-dates/kul-dates.ts:94:15
ketchup-lite:            Type 'string[]' is not assignable to type 'KulDatesLocales[]'.Type
ketchup-lite:            'string' is not assignable to type 'KulDatesLocales'.
ketchup-lite:      L93:  getLocales(): Array<KulDatesLocales> {
ketchup-lite:      L94:      const items: Array<KulDatesLocales> = Object.keys(KulDatesLocales
ketchup-lite:      L95:          .map((key) => KulDatesLocales[key])
ketchup-lite: [12:49.7]  build failed in 2.13 s

——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 

 Lerna (powered by Nx)   Running target build for project ketchup-lite failed

Failed tasks:

- ketchup-lite:build

Hint: run the command with --verbose for more details.

@christian-bromann
Copy link
Member Author

@lucafoscili thank you 🙏 can you do me a favor and raise a new issue with the content of your last comment? This will help us to better track this.

@lucafoscili
Copy link

absolutely!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
2 participants