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
Fully resolve absolute imports #79
Changes from all commits
3fe8c13
01b6a13
e1df3bb
d6039bd
aeca57f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import "<CWD>/fixtures/absoluteImports/string/nested/node_modules/polyfill-a"; | ||
import "<CWD>/fixtures/absoluteImports/string/node_modules/polyfill-b"; | ||
import "<CWD>/fixtures/absoluteImports/string/nested/node_modules/polyfill-a/index.js"; | ||
import "<CWD>/fixtures/absoluteImports/string/node_modules/polyfill-b/index.js"; | ||
a; | ||
b; |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import "<CWD>/fixtures/absoluteImports/subpath/node_modules/polyfill-a/auto"; | ||
import "<CWD>/fixtures/absoluteImports/subpath/node_modules/@polyfill/b/auto"; | ||
import "<CWD>/fixtures/absoluteImports/subpath/node_modules/polyfill-a/auto.js"; | ||
import "<CWD>/fixtures/absoluteImports/subpath/node_modules/@polyfill/b/auto.js"; | ||
a; | ||
b; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-a"; | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-a/index.js"; | ||
a; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-b"; | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-a"; | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-b/index.js"; | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-a/index.js"; | ||
a; | ||
b; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import "<CWD>/fixtures/absoluteImports/true/nested/node_modules/polyfill-b"; | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-a"; | ||
import "<CWD>/fixtures/absoluteImports/true/nested/node_modules/polyfill-b/index.js"; | ||
import "<CWD>/fixtures/absoluteImports/true/node_modules/polyfill-a/index.js"; | ||
a; | ||
b; |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Array.from; | ||
Math.clz32; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
import "<CWD>/array.from/auto"; | ||
import "<CWD>/array.from/auto.js"; | ||
import "<CWD>/math.clz32/auto.js"; | ||
Array.from; | ||
Math.clz32; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correctly shows that what is ignored? I’m a bit confused here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I’m pretty sure package.json exports aren’t considered by node unless you’re using a bare identifier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The full output is import "<CWD>/array.from/auto.js";
import "<CWD>/math.clz32/auto.js";
Array.from;
Math.clz32; I added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahh ok. why is this preferable over bare identifiers? Absolute paths aren’t portable across machines - doesn’t this increase the likelihood they’ll end up in a published package? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can indeed rely on that, and using peerDeps, you should. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You really can't, If I were to tell next.js to transpile
For your own project sure, you can do it with peer dependencies but that would force all projects using Next.js, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That’s because core-js should be a peer dep of material-ui. I’d file a bug there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the point - if it peer depends on core-js 2, even implicitly, then it's incompatible with your project and you simply can't use it. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
Array.from; | ||
Math.clz32; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
import _ArrayFrom from "<CWD>/array.from"; | ||
import _ArrayFrom from "<CWD>/array.from/index.js"; | ||
import _MathClz from "<CWD>/math.clz32/index.js"; | ||
_ArrayFrom; | ||
_MathClz; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NOTE: <CWD> is the top-level node_modules folder | ||
(that's how `@babel/helper-plugin-test-runner` works). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
regeneratorRuntime.wrap(function() {}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@@/polyfill-regenerator", | ||
{ | ||
"method": "usage-global", | ||
"absoluteImports": true | ||
} | ||
] | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import "<CWD>/regenerator-runtime/runtime.js"; | ||
regeneratorRuntime.wrap(function () {}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
regeneratorRuntime.wrap(function() {}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@@/polyfill-regenerator", | ||
{ | ||
"method": "usage-pure", | ||
"absoluteImports": true, | ||
"#__secret_key__@babel/runtime__compatibility": { | ||
"useBabelRuntime": "@babel/runtime" | ||
} | ||
} | ||
] | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import _regeneratorRuntime from "<CWD>/@babel/runtime/regenerator/index.js"; | ||
|
||
_regeneratorRuntime.wrap(function () {}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
regeneratorRuntime.wrap(function() {}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"plugins": [ | ||
[ | ||
"@@/polyfill-regenerator", | ||
{ | ||
"method": "usage-pure", | ||
"absoluteImports": true | ||
} | ||
] | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import _regeneratorRuntime from "<CWD>/regenerator-runtime/runtime.js"; | ||
|
||
_regeneratorRuntime.wrap(function () {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR: we need to update
nativeRequireResolve
to use cheap semver so versions like8.10
does not fall torequireResolve
.