Comments (11)
I'll open a PR that reverts this change, hopefully @sokra can take a look soon.
from enhanced-resolve.
would it be possible to roll this back?
from enhanced-resolve.
Here are a couple more findings after some debugging.
I logged file, err, stat
in:
// FileExistsPlugin.js
fs.stat(file, (err, stat) => {
if(file.includes('storybook-config-entry')) {
console.log({file, err, stat})
}
// ...
}
And did the same in 5.11.0.
Here's running Storybook with enhanced-resolve 5.10.0:
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.mjs',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.mjs'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.mjs'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.js',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.js'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.js'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.jsx',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.jsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.jsx'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.ts',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.ts'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.ts'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.tsx',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.tsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.tsx'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.json',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.json'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.cjs',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.cjs'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.cjs'
},
stat: undefined
}
{
file: 'storybook-config-entry.js',
err: null,
stat: VirtualStats {
dev: 8675309,
nlink: 0,
uid: 1000,
gid: 1000,
rdev: 0,
blksize: 4096,
ino: 45000001,
mode: 33188,
size: 5591,
blocks: 1,
atime: 2022-11-22T17:56:59.907Z,
mtime: 2022-11-22T17:56:59.907Z,
ctime: 2022-11-22T17:56:59.907Z,
birthtime: 2022-11-22T17:56:59.907Z
}
}
So it seems like it tries to resolve storybook-config-entry.js
in all possible extensions (cjs, mjs, etc...) and fails. Then tries again, and succeeds, and then you see the virtual module is found.
Now, for version 5.11.0, the output is the following. It just fails to find the file, retries, and fails 6 times:
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.mjs',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.mjs'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.mjs'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.js',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.js'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.js'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.jsx',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.jsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.jsx'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.ts',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.ts'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.ts'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.tsx',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.tsx'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.tsx'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.json',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.json'
},
stat: undefined
}
{
file: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.cjs',
err: [Error: ENOENT: no such file or directory, stat 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.cjs'] {
errno: -2,
code: 'ENOENT',
syscall: 'stat',
path: 'Users/yannbraga/open-source/status-page/storybook-config-entry.js.cjs'
},
stat: undefined
}
When running Storybook with WVM_DEBUG=true
, in both 5.10.0 and 5.11.1 I see these logs happening before fs.stat
is first invoked: preview Write virtual module: /Users/yannbraga/open-source/status-page/storybook-config-entry.js
, so supposedly the file is correctly there?
Could this be an incompatibility with webpack-virtual-modules
?
from enhanced-resolve.
would it be possible to roll this back?
agree
from enhanced-resolve.
Yep - just traced the same line of reasoning. By same implication, there is no caching done on any requests with options, which probably isnt what we want from a perf perspective either (aside from virtual modules).
True fix is to support cache for requests with options, but that may take a small while to get working (need to check if there are wacky options for certain fs calls that might complicate things). Probably best to revert so as not to rush figuring that all out
cc @sokra
from enhanced-resolve.
In the unlikely event of upgrading only enhanced-resolve, but not graceful-fs or webpack, we can expect people to update graceful-fs to fix the bug they are running into.
This doesn't seem like something we can do.. we're not in control of which version enhanced-resolve
the user uses.
We also do not have a dependency on graceful-fs
.
And though we can force newer version of webpack to be used, this is mostly up to the end-user of storybook to decide.
Every new installation of storybook is broken, every user that has no lockfile, or updates their lockfile runs into this issue.
from enhanced-resolve.
How to reproduce the issue
The fastest way to get a Storybook + Webpack project is by running the following command in the terminal:
npx giget "gh:storybookjs/repro-templates-temp/react-webpack/17-ts/after-storybook#next" webpack-repro
cd webpack-repro
yarn
yarn storybook
from enhanced-resolve.
@yannbf Thanks for the detailed repro steps! So the change introduced in:
#324
has a consequence that additional options
argument is passed, it does not matter what is passed inside options
object, the mere fact is important to the logic at this line:
https://github.com/webpack/enhanced-resolve/blob/main/lib/CachedInputFileSystem.js#L163
It sends all the requests having options
argument directly to the core file system module without consulting with the cache implemented in this class. This breaks the whole idea of webpack-virtual-modules
which is based on injecting virtual modules into this cache. I can do nothing here to fix this from webpack-virtual-modules
side. The only other idea to have virtual modules is non-webpack related - direct patching of core file system module, which I have tried to avoid because of the higher level of intrusion into low-level mechanisms.
from enhanced-resolve.
would it be possible to roll this back?
agree, too!! :)
from enhanced-resolve.
If you can't wait for this issue to be resolved and you are using NPM 8
add this override to your package.json
"overrides": {
[email protected]": "5.10.0"
}
I'm not sure what the equivalent using resolutions
in yarn
would be.
from enhanced-resolve.
in yarn you can do:
"resolutions": {
"enhanced-resolve": "5.10.0"
}
from enhanced-resolve.
Related Issues (20)
- virtual module not found error HOT 1
- add type defines for `CachedInputFileSystem` ? HOT 5
- CachedInputFileSystem OOM when duration is infinity HOT 5
- signature of method `stat` in interface `FileSystem` mismatches. HOT 2
- bug: exports map key with star in the middle doesn't work HOT 1
- is this possible with webpack AliasPlugin to automatically switch to a different alias when original file is deleted? HOT 7
- can't resolve exports pattern startsWith wildcards HOT 1
- Use of `extensionAlias` fails resolution of subpath exports in `exports` fields HOT 2
- resolving packages entrypoints with a non-standard node_modules HOT 4
- `exports.types` after `exports.default` HOT 5
- Hooks do not fire events from CSS/SCSS imports HOT 6
- AliasPlugin crash when file is deleted or rename (have to restart to make it work)
- Seeing "Error: No file content" for different package.json files when webpack rebuilds HOT 1
- ESM: Resolving to the wrong package with `exports` and nested same package but different versions HOT 3
- ESM: package.exports array target not conforming to the ESM specification HOT 10
- Add ability to handle win32 relative paths HOT 4
- [Feature Request]: Support resolve the modules with hard-links HOT 4
- lstat error when requiring virtual modules HOT 1
- Can i use withOptions Api ? HOT 1
- File Extension Substitution for TypeScript Support HOT 18
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 enhanced-resolve.