路路路
WARNING in d:/dws/projects/febs/febs/~/express/lib/view.js
Critical dependencies:
78:29-56 the request of a dependency is an expression
@ d:/dws/projects/febs/febs/~/express/lib/view.js 78:29-56
路路路
Related code: https://github.com/strongloop/express/blob/master/lib/view.js#L78
P.S Webpack is very useful even in build server side bundles. It can reduce the size of release packages by include required js file only.
Hi! I'm not really sure what the warning is about. I have never used Webpack and the warning is very cryptic. If there is a suggestion for code we can change to prevent the warning, I'd be happy to accept a pull request, but otherwise we are not likely to figure out the cause without you letting us know.
Searching around on Google, all I found was people posting the Webpack configuration to use when trying to bundle Express applications (like https://github.com/webpack/webpack/issues/1206 for example). No one has ever created an issue in our repository before and looking at all those online posts, it doesn't seem like anyone has suggested there is anything Express can actually change in our code base to address this.
If you have a specific suggestion on what we need to change (even as a pull request!) to get the warning to go away, let us know! I'm going to close this for now, as hopefully that link (or one of the Google results) helps you achieve whatever you goal with Webpack is. Since Express is maintained by server-side-only folk, no one knows anything about Webpack, so we aren't going to investigate more than what I just tried. A suggestion on what specific change needs to happen to our code would be the best way to re-open the issue :)
@dougwilson , There is a way to avoid the warning:
change these lines
if (!opts.engines[this.ext]) {
// load engine
opts.engines[this.ext] = require(this.ext.substr(1)).__express;
}
to
if (!opts.engines[this.ext]) {
// use external loader to load engine.
opts.engines[this.ext] = engineLoader(this.ext.substr(1));
}
and add this line to file head
var engineLoader = require('./express-engine-loader');
and then create a new file express-engine-loader.js
// file: express-engine-loader.js
module.exports = function engineLoader(ext) {
return require(ext).__express;
};
OK, that's all.
Now, users can use webpack.NormalModuleReplacementPlugin to replace express-engine-loader in webpack's build process to use static require which is friendly to bundler, or even ignore it by webpack.IgnorePlugin.
Could this be reopened please and corrected with the above.
Time to comment again to raise this issue in the list. I encountered this same warning today.
Most helpful comment
Could this be reopened please and corrected with the above.