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: tsconfig alias path transpilation regressed in 3.4.1 #4550

Closed
3 tasks done
liamdebeasi opened this issue Jul 7, 2023 · 1 comment
Closed
3 tasks done

bug: tsconfig alias path transpilation regressed in 3.4.1 #4550

liamdebeasi opened this issue Jul 7, 2023 · 1 comment
Assignees
Labels

Comments

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Jul 7, 2023

Prerequisites

Stencil Version

3.4.1

Current Behavior

TSConfig alias paths such as @utils/helper are not being transpiled to their relative paths (i.e. ../../utils/helpers) on build, resulting in warning when consuming the collection target:

[ WARN  ]  Bundling Warning UNRESOLVED_IMPORT
           '@utils/helpers' is imported by
           node_modules/@ionic/core/dist/collection/components/datetime-button/datetime-button.js, but could not be
           resolved – treating it as an external dependency

Expected Behavior

I expect there to be no warning.

System Info

     System: node 16.19.0
    Platform: darwin (22.2.0)
   CPU Model: Apple M1 Pro (8 cpus)
    Compiler: /Users/liamdebeasi/Ionic/ionic/core/node_modules/@stencil/core/compiler/stencil.js
       Build: 1687785553
     Stencil: 3.4.1 🐨
  TypeScript: 5.0.4
      Rollup: 2.42.3
      Parse5: 7.1.2
      Sizzle: 2.42.3
      Terser: 5.18.1

Steps to Reproduce

  1. Clone https://github.com/ionic-team/ionic-framework
  2. In core run npm install && npm run build.
  3. Open core/dist/collection/components/datetime-button/datetime-button.js. Observe that @utils/helper is still an import path at the top.
  4. Install Stencil 3.4.0 using npm install @stencil/[email protected].
  5. Run npm run build.
  6. Open core/dist/collection/components/datetime-button/datetime-button.js. Observe that the correct relative path is specified.

Code Reproduction URL

https://github.com/ionic-team/ionic-framework

Additional Information

  • This appears to be fixed in Stencil 4.0.0, however it would be great to get that fixe backported since 3.4.1 is the latest version of 3.x.
@ionitron-bot ionitron-bot bot added the triage label Jul 7, 2023
github-merge-queue bot pushed a commit to ionic-team/ionic-framework that referenced this issue Jul 7, 2023
Issue number: resolves #27762

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Stencil 3.4.1 regressed the tsconfig alias path transpilation. This is
fixed in 4.0.0 though.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Downgrade to Stencil 3.4.0. Stencil 4.0 has breaking changes, so I'd
like to wait on upgrading until we can work through any of the changes
that impact Ionic.

This reverts commit 9793b3c.


## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Stencil issue: ionic-team/stencil#4550
@tanner-reits tanner-reits self-assigned this Jul 7, 2023
@tanner-reits
Copy link
Member

@liamdebeasi So, this isn't technically a regression as the behavior in 3.4.1 is how this should behave. The problem is that the root-level transformAliasedImportPaths doesn't actually control the transformations in dist (and subsequently dist-collection that gets synthetically injected as an addition output target). For paths in this output to get transformed, you'll need to have the following in the dist target config:

{
  type: 'dist',
  transformAliasedImportPathsInCollection: true,
  ...
}

We agree it's not ideal to have two flags controlling similar behavior. The plan (as of now) is that the output target specific flag will be removed in the next major release of Stencil and all path transformations will be determined by the root-level transformAliasedImportPaths flag.

The reason this is "fixed" in v4 is because transformAliasedImportPaths and transformAliasedImportPathsInCollection both now default to true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants