netlify-express
netlify-express copied to clipboard
WARNING in ./node_modules/express/lib/view.js
When yarn build:
WARNING in ./node_modules/express/lib/view.js
81:13-25 Critical dependency: the request of a dependency is an expression
@ ./node_modules/express/lib/view.js
@ ./node_modules/express/lib/application.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./express/server.js
any update on this issue. I get the same when I do yarn build?
Hey guys would be great to get some help on this - I am not sure how to solve this in the netlify functions context...
https://github.com/webpack/webpack/issues/196
I also see it using npm run build
, and when I deploy a new site with it: https://app.netlify.com/sites/wonderful-golick-53c4d8/deploys/5ca55c306e2fd5fa0e0ff10d
However, the new site loads, so things appear to be working.
Is this blocking anyone from deploying successfully? If so, I am interested in how your site is set up.
I found the same issue.
WARNING in ./node_modules/express/lib/view.js 81:13-25 Critical dependency: the request of a dependency is an expression @ ./node_modules/express/lib/application.js @ ./node_modules/express/lib/express.js @ ./node_modules/express/index.js @ ./src/main/index.js @ multi ./node_modules/electron-webpack/out/electron-main-hmr/main-hmr ./src/main/index.js
same issue
Also having this issue
Use webpack-node-externals, I mean please add following code in your webpack.config.js
const nodeExternals = require('webpack-node-externals');
{ target: 'node', externals: [nodeExternals()], }
Use webpack-node-externals, I mean please add following code in your webpack.config.js
const nodeExternals = require('webpack-node-externals');
{ target: 'node', externals: [nodeExternals()], }
maybe you can provide an example!!?
This is not helping
you need to first install webpack-node-externals dependency
npm install webpack-node-externals
or
yarn add webpack-node-externals
and then add whatever @heshamelmasry77 has suggested in the webpack.config.js
Use webpack-node-externals, I mean please add following code in your webpack.config.js
const nodeExternals = require('webpack-node-externals');
{ target: 'node', externals: [nodeExternals()], }
Thanks, This solution solved my problem
where is the webpack.config.js located?
It's your file. You create it in order to customize webpack. I suggest you check out the webpack tutorial here.
Use webpack-node-externals, I mean please add following code in your webpack.config.js
const nodeExternals = require('webpack-node-externals');
{ target: 'node', externals: [nodeExternals()], }
Doesn't this prevent the dependent node modules being bundled, and therefore they'll need to be added another way into the dist? If so, how should that be done?
Still the same :/
You can add "express" to the externals object in webpack.config.js
.
module.exports = {
...
output: { ... },
externals: {
express: "require(\"express\")"
},
...
}
This will prevent webpack from bundling express
. Any other server-side specific libraries can be added to the externals object in order to prevent them from being unnecessarily bundled.
Externals is also used when creating npm packages. When creating a React component library for instance you can assume that the person consuming your package has React installed as a dependency so you don't want to add it to the bundle at compilation time, so you add it to the externals object. Your package will use the React library in the /node_modules/
of the project it is being consumed in.
If you don't want to use webpack-node-externals
, I suppose this method gives you a lot more control over your webpack configuration.
@joshgreifer webpack-node-externals
has an options.whitelist
for your client-side dependencies.
What if I want express to be bundled along with my node app?
I don't understand why this happens. Tried both solutions, none worked, had to stash changes and git pull again... In my case it was during development bundling of a React app using Chakra UI (nothing to do with Netlify)
Following ... I Got the same issue installing "express": "^4.17.1",
Following ... I Got the same issue installing "express": "^4.17.1",
Same Here. Not sure why this is still an issue
Same issue here rip
I don't understand, why the code is provided as non working and yet the demo works?
UPDATE
Everyone, make these changes and the problem is going away:
https://github.com/neverendingqs/netlify-express/pull/5/files
UPDATE2: the /dist directory is absent. Create it and place the index inside of it.
Kindly check if you have any unwanted imports in your component