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
Thanks for making this transform! It's cool to be able to make use of common-shake with browserify!
I ran into an issue when I was trying to run esmify in a lerna hoisted monorepo with a package dependency symlinked into node_modules. Here's what the simplified project structure looks like:
Because the node_modules/pkg1 symlink ends up being resolved into packages/pkg1, the isNodeModule function returns false for the packages/pkg1/fn.js, and since it is actually outside of the pkg2 package I'm trying to compile, the transforms are never run on packages/pkg1/fn.js.
Additionally, when I run browserify from pkg2/ folder, the isNodeModule returns false for ../node_modules/pkg1/index.js as well. The error I get is:
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
This is because neither global nor local transforms run on pkg1/fn.js. I was able to hack a solution by adding two if clauses (packages/ is standard for lerna, but is not a requirement), but it doesn't seem bullet-proof:
Perhaps there could be an option like projectPathRegex so projects could specify it separately? Alternatively, we could check if the relative path starts with ../. Do you maybe have a better suggestion?
Thanks!
The text was updated successfully, but these errors were encountered:
Hi @mattdesl,
Thanks for making this transform! It's cool to be able to make use of
common-shake
withbrowserify
!I ran into an issue when I was trying to run
esmify
in a lerna hoisted monorepo with a package dependency symlinked intonode_modules
. Here's what the simplified project structure looks like:Because the
node_modules/pkg1
symlink ends up being resolved intopackages/pkg1
, theisNodeModule
function returnsfalse
for thepackages/pkg1/fn.js
, and since it is actually outside of thepkg2
package I'm trying to compile, the transforms are never run onpackages/pkg1/fn.js
.Additionally, when I run
browserify
frompkg2/
folder, theisNodeModule
returns false for../node_modules/pkg1/index.js
as well. The error I get is:This is because neither global nor local transforms run on
pkg1/fn.js
. I was able to hack a solution by adding two if clauses (packages/
is standard for lerna, but is not a requirement), but it doesn't seem bullet-proof:Perhaps there could be an option like
projectPathRegex
so projects could specify it separately? Alternatively, we could check if the relative path starts with../
. Do you maybe have a better suggestion?Thanks!
The text was updated successfully, but these errors were encountered: