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

fix(output-targets): fix path normalization logic #4545

Merged
merged 1 commit into from
Jul 14, 2023

Commits on Jul 14, 2023

  1. fix(output-targets): fix path normalization logic

    In #4317 as part of removing in-browser compilation support we removed
    the polyfills for nodejs built-in modules like `path` which were
    injected by Rollup during build-time. Although the _main_ purpose of
    these polyfills was allowing Stencil to run in the browser in the case
    of the `path` module there was also a secondary purpose which was
    ensuring that paths were treated the same way across supported platforms
    (posix + windows).
    
    See, for instance, the following lines in the polyfill:
    
    https://github.com/ionic-team/stencil/blob/b911f1986a0d583bd1e3cd42cbbca9b255c32f2d/src/compiler/sys/modules/path.ts#L35-L38
    
    These functions basically wrapped the existing path implementation with
    our `normalizePath` helper, which would ensure that the output paths
    would be the same on both windows and posix systems (e.g. macOS and
    linux).
    
    When we merged #4317 an effort was made to add `normalizePath` around
    the codebase where it was thought that various paths being calculated
    needed to be platform-independent, however, a few locations were missed
    (in particular, some paths output into typedefs, which would show up as
    non-posix paths when building on windows).
    
    To address the issue we introduce `relative` and `join` functions into
    the existing path-related `utils` file (which is incidentally renamed)
    which work similarly to how the patched functions in the old polyfill
    did. Then several usage sites are changed to import those new utils
    instead of the 'raw' functions from `path`. Together these changes
    should ensure that Stencil's output is not platform-dependent.
    
    See here for an issue reporting the problem: #4543
    alicewriteswrongs committed Jul 14, 2023
    Configuration menu
    Copy the full SHA
    f3d6a40 View commit details
    Browse the repository at this point in the history