You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a project which has pirates as a transitive dependency, and now get an exception after upgrading from 4.0.1 to 4.0.3. The commit which seems to cause my problems seems to be this one:
I believe this worked previously because for extensions which are not explicitly specified here, the default used to be to use the default JS loader. As far as I can tell, the require('esm')(module) line now throws an error if there are any imports on the path which do not use a known extension. If I pass in ['.jsx', '.mjs', '.cjs'] as extensions in L6 of that file, then the error no longer occurs for my project.
I am willing to make a PR to the complate-fractal project to change that line there, but it feels like the wrong place to correct it because I actually would prefer to use the JavaScript loader to load .cjs and .mjs files. Here it is also not possible to leave off the extensions because then babel tries to register the JSX loader for all the .js files as well and that causes problems when loading some dependencies (e.g. prettier). For me, specifying the .cjs and .mjs in the extension list here also feels like a smell -- currently the code will work if I modify that, but if in the future my transitive dependencies are updated to include imports from different file extensions, then there is a likelihood that this will break in the code again.
Hi,
I am working on a project which has
pirates
as a transitive dependency, and now get an exception after upgrading from4.0.1
to4.0.3
. The commit which seems to cause my problems seems to be this one:cf74daf
As far as I can tell, the error occurs in this library here which uses
@babel/register
which usespirates
as a dependency: https://github.com/complate/complate-fractal/blob/master/src/transpiler.js#L6The code that I am having problems with is as follows:
I believe this worked previously because for extensions which are not explicitly specified here, the default used to be to use the default JS loader. As far as I can tell, the
require('esm')(module)
line now throws an error if there are any imports on the path which do not use a known extension. If I pass in['.jsx', '.mjs', '.cjs']
as extensions in L6 of that file, then the error no longer occurs for my project.I am willing to make a PR to the
complate-fractal
project to change that line there, but it feels like the wrong place to correct it because I actually would prefer to use the JavaScript loader to load.cjs
and.mjs
files. Here it is also not possible to leave off theextensions
because then babel tries to register the JSX loader for all the.js
files as well and that causes problems when loading some dependencies (e.g. prettier). For me, specifying the.cjs
and.mjs
in the extension list here also feels like a smell -- currently the code will work if I modify that, but if in the future my transitive dependencies are updated to include imports from different file extensions, then there is a likelihood that this will break in the code again.Here is my demo project which currently throws an error when running: https://github.com/joyheron/complate-fractal-demo
I've created a branch to demonstrate that downgrading the
pirates
version to4.0.1
solves the issue: https://github.com/joyheron/complate-fractal-demo/tree/complate-fractal-works-with-pirates-4.0.1The text was updated successfully, but these errors were encountered: