Comments (11)
Ok, so far I've submitted a patch to require-from-string
, doing the cleanup: floatdrop/require-from-string#9.
I'm still not entirely sure it belongs there, let's see what maintainers say. But if it won't be merged, I think we still can continue to use require-from-string
and do this cleanup in cosmiconfig
instead.
from cosmiconfig.
Fixed and released in 3.0.1 ๐
from cosmiconfig.
That's a bummer and also very interesting, @SevInf. Thanks for investigating it. Do you have any recommendations that might fix it?
from cosmiconfig.
Thanks for investigating it
+1 from me as well.
Is this a bug in require-from-string
or is the problem related to how cosmiconfig
uses it?
from cosmiconfig.
@davidtheclark it looks like replacing require-from-string
with something like import-fresh
fixes it. I can send pull request tomorrow.
@sudo-suhas from require-from-string
point of view, I think, this behavior is correct, it just might not align that well with cosmiconfig
.
from cosmiconfig.
Thanks @SevInf. Isn't import-from
more suited to the purpose than import-fresh
?
from cosmiconfig.
Sorry. Closed by mistake.
from cosmiconfig.
@sudo-suhas I think by the time it gets to loadJs
cosmiconfig have already figured out the absolute path to the file, so import-from
won't add anything new to a plain require
here.
I assumed require-from-string
is used instead of require
to bypass require.cache
. Is it true? If so, import-fresh
will preserve this behavior.
from cosmiconfig.
Honestly not too sure. Perhaps @davidtheclark can clarify. AFAIK there is no intent to bypass require.cache
. Also see sindresorhus/import-from#4 (comment).
from cosmiconfig.
@SevInf @sudo-suhas: For a little background you can read #21 and #51.
The summary: We were using require-from-string because it allowed us to avoid reading the file multiple times and to stay asynchronous. Those are the things we would sacrifice, I think, if we switched to require. What do you think about the trade-offs?
from cosmiconfig.
I tried to upgrade deps so that this issue would be fixed. However, faced an issue due to jest + require-from-string
which is failing a lot of tests. Have created a PR floatdrop/require-from-string#10 which will fix the issue.
from cosmiconfig.
Related Issues (20)
- `explorer.search(...)` crashes with `{stopDir: undefined}` option HOT 2
- Node.js version breaking change HOT 2
- Why does cosmiconfig require Node version greater than 18.0.0? HOT 2
- Could not resolve module "node:os" from
- Regression in v8.3.x - missing json config file doesn't always return null HOT 9
- SyntaxError: Unexpected token '.' HOT 2
- Lerna-Lite project having an empty `.config.json` file gets picked up by cosmiconfig and is unexpected - behavior changed after 8.0 HOT 8
- Add link to Python port of Cosmiconfig HOT 2
- README doesn't mention .mjs files inside of a config directory HOT 2
- Error: EACCES: permission denied, open '/.config/puppeteerrcโ HOT 9
- Offer a "minimal" version with less dependencies
- Also find [`pnpm`] package.yaml/json5 properties HOT 1
- Module "typescript" possibly misplaced as a dev dependency HOT 1
- cosmiconfig requires at least version 4 of Node, please upgrade HOT 1
- Please release source code to npm if you release source map files HOT 1
- Question: latest v9 not mentioned in changelog and no github release exists HOT 2
- Meta config files are not looked in cwd anymore? (in v9 changelog but not in README HOT 6
- It says `.ts` configs are supported automatically, and also `.cjs` and `.mjs`, but why `.cts` and `.mts` are not supported?
- CJS configuration files in ESM projects do not freshly import
- Module not found errors when config imports from a file path
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosmiconfig.