"asset not found" Error while file is present in webpack-assets.json
See original GitHub issueHi,
I came across this issue and I am not sure if it’s due to the unusual folder structure of my project or if it’s a bug from webpack-isomorphic-tools.
The issue can be reproduced on https://github.com/happypoulp/webpack-isomorphic/tree/issue-production
After running npm run webpack
if you run npm start
to start the application server, you’ll see errors being emitted by webpack-isomorphic tools about some assets not being found.
Here is the debug output:
.local ~/Codes/webpack-iso > npm start
> webpack-iso@1.0.0 start /Users/fbonnefont/Codes/webpack-iso
> NODE_ENV=dev node app/bin/server.js
[webpack-isomorphic-tools] [debug] instantiated webpack-isomorphic-tools with options {
"debug": true,
"assets": {
"json": {
"extensions": [
"json"
]
},
"scss": {
"extensions": [
"scss"
]
}
},
"webpack_assets_file_path": "webpack-assets.json",
"webpack_stats_file_path": "webpack-stats.json"
}
[webpack-isomorphic-tools] [debug] entering development mode
[webpack-isomorphic-tools] [debug] registering require() hooks for assets
[webpack-isomorphic-tools] [debug] registering a require() hook for *.json
[require-hook] [debug] Hooking into *.json files loading
[require-hook] [debug] -----------------------------------------------
[require-hook] [debug] Overriding an already existing require() hook
[require-hook] [debug] for file extension .json
[require-hook] [debug] -----------------------------------------------
[webpack-isomorphic-tools] [debug] registering a require() hook for *.scss
[require-hook] [debug] Hooking into *.scss files loading
FAKE SERVER
[webpack-isomorphic-tools] [debug] flushing require() caches
[require-hook] [debug] require() hook fired for /Users/fbonnefont/Codes/webpack-iso/app/src/base.scss
[webpack-isomorphic-tools] [debug] require() called for /Users/fbonnefont/Codes/webpack-iso/app/src/base.scss
[webpack-isomorphic-tools] [debug] requiring ./src/base.scss
[require-hook] [debug] require() hook fired for /Users/fbonnefont/Codes/webpack-iso/app/webpack-assets.json
[require-hook] [debug] Fallback to original loader
[webpack-isomorphic-tools] [error] asset not found: ./src/base.scss
[require-hook] [debug] require() hook fired for /Users/fbonnefont/Codes/webpack-iso/app/src/mod-1.scss
[webpack-isomorphic-tools] [debug] require() called for /Users/fbonnefont/Codes/webpack-iso/app/src/mod-1.scss
[webpack-isomorphic-tools] [debug] requiring ./src/mod-1.scss
[webpack-isomorphic-tools] [error] asset not found: ./src/mod-1.scss
[require-hook] [debug] require() hook fired for /Users/fbonnefont/Codes/webpack-iso/app/src/file.json
[webpack-isomorphic-tools] [debug] require() called for /Users/fbonnefont/Codes/webpack-iso/app/src/file.json
[webpack-isomorphic-tools] [debug] requiring ./src/file.json
[webpack-isomorphic-tools] [error] asset not found: ./src/file.json
...
What puzzles me is that for example ./src/base.scss
is actually present in webpack-assets.json but under the path ./app/src/base.scss
… The project_base_path I gave to webpack-isomorphic-tools server is the same as the one used in my webpack.config.js as suggested in your docs but I think that the issue might come from that setup.
Do you know what the issue could come from?
Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:18 (10 by maintainers)
I know this library is deprecated and I can’t tell if this is the same issue, but after upgrading to Webpack 4 I’m getting lots of
repeated for all of my css imports
and a huge stack trace starting with:
FYI I’m posting this in every issue and PR to notify whoever may be interested: today I’ve released an alternative helper library called
universal-webpack
. It takes a different approach thanwebpack-ismorphic-tools
and instead of hacking Node.jsrequire()
calls it just compiles all code withtarget: 'node'
webpack configuration option. As a result, all Webpack plugins and features are supported. If you think you might need that here’s an example project: https://github.com/halt-hammerzeit/webpack-react-redux-isomorphic-render-example