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

Add .js extension to virtual tslib #170

Merged
merged 1 commit into from
Sep 9, 2019

Conversation

Andarist
Copy link
Contributor

@Andarist Andarist commented Sep 8, 2019

Rollup has preserveModules option which is used to skip flat bundling and writing instead to disk a directory structure resembling the input one. This plugin makes tslib a "virtual" module by default - this means that it virtually creates an input file for Rollup to consume, but obviously it's not part of the input directory structure. To deal with it in combination with preserveModules Rollup creates a _virtual output directory and put such modules in it. As filename of such a virtual module it uses "as is" the given identifier - in this case \0tslib. Problem is that it doesn't add any extension to it and this trips other tools if you don't include the extension in the virtual identifier - i.e. webpack and it's resolving algorithm.

@ezolenko ezolenko merged commit dca40be into ezolenko:master Sep 9, 2019
@ezolenko
Copy link
Owner

ezolenko commented Sep 9, 2019

Thanks, in 0.24.1 now

@mnlbox
Copy link

mnlbox commented Jul 7, 2020

@Andarist, @ezolenko anyway to prevent the creation of _tslib.js in preserveModules mode?

@Andarist Andarist deleted the virtual-tslib-with-ext branch July 7, 2020 20:03
NSeydoux added a commit to inrupt/solid-client-vc-js that referenced this pull request Sep 9, 2021
This prevents the bahaviour documented in
ezolenko/rollup-plugin-typescript2#170 from
happening. Namely, a _virtual/tslib.js file would be emitted, which
confuses NodeJS because we expect all ES modules to have the .mjs
extension.

The previous syntax feels more elegant though, so I think it should be
re-enabled once the bug is resolved. Also, there's no guarantee that
this issue can alway be worked around so easily.
NSeydoux added a commit to inrupt/solid-client-vc-js that referenced this pull request Sep 9, 2021
This prevents the bahaviour documented in
ezolenko/rollup-plugin-typescript2#170 from
happening. Namely, a _virtual/tslib.js file would be emitted, which
confuses NodeJS because we expect all ES modules to have the .mjs
extension.

The previous syntax feels more elegant though, so I think it should be
re-enabled once the bug is resolved. Also, there's no guarantee that
this issue can alway be worked around so easily. Issue tracking is
available at
ezolenko/rollup-plugin-typescript2#282.
NSeydoux added a commit to inrupt/solid-client-vc-js that referenced this pull request Sep 15, 2021
This re-enables package import tests. They had been disabled until the package was published on NPM, and
mistakingly hadn't been re-enabled.

* Fix umd module name to avoid conflicts

* Work around rollup ts plugin ES issue: This prevents the bahaviour documented in
ezolenko/rollup-plugin-typescript2#170 from
happening. Namely, a _virtual/tslib.js file would be emitted, which
confuses NodeJS because we expect all ES modules to have the .mjs
extension.

The previous syntax feels more elegant though, so I think it should be
re-enabled once the bug is resolved. Also, there's no guarantee that
this issue can alway be worked around so easily. Issue tracking is
available at
ezolenko/rollup-plugin-typescript2#282.

* Disable defaulting to solid-client-authn-browser: Trying to import the package in an environment where it's not available
causes Webpack to fail. Until a proper fix is found, this works around
the issue by simply not trying to auto-import the
@inrupt/solid-client-authn package.
@agilgur5
Copy link
Collaborator

@mnlbox please see #240 (comment) for an answer to that question.

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

Successfully merging this pull request may close these issues.

4 participants