Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WARNING in ./node_modules/express/lib/view.js #4

Open
balibou opened this issue Jan 15, 2019 · 22 comments
Open

WARNING in ./node_modules/express/lib/view.js #4

balibou opened this issue Jan 15, 2019 · 22 comments

Comments

@balibou
Copy link

balibou commented Jan 15, 2019

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
@dturton
Copy link

dturton commented Feb 14, 2019

any update on this issue. I get the same when I do yarn build?

@ydennisy
Copy link

Hey guys would be great to get some help on this - I am not sure how to solve this in the netlify functions context...

webpack/webpack#196

@neverendingqs
Copy link
Owner

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.

@mikeyzhe
Copy link

mikeyzhe commented Apr 5, 2019

I found the same issue.

@beinimaliesi
Copy link

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

@virgilCane
Copy link

Also having this issue

@ajay-whiz
Copy link

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()],
}

@heshamelmasry77
Copy link

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!!?
Screenshot 2019-11-08 at 03 41 36
This is not helping

@csmper
Copy link

csmper commented Nov 11, 2019

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

@hamidone
Copy link

hamidone commented Dec 3, 2019

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

@neerujjain
Copy link

where is the webpack.config.js located?

@aaronleesmith
Copy link

It's your file. You create it in order to customize webpack. I suggest you check out the webpack tutorial here.

@joshgreifer
Copy link

joshgreifer commented Jan 24, 2020

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?

@pz1996r
Copy link

pz1996r commented Mar 18, 2020

Still the same :/
Zrzut ekranu 2020-03-18 o 14 33 56

@ghost
Copy link

ghost commented Jun 19, 2020

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.

@frague
Copy link

frague commented Nov 23, 2020

What if I want express to be bundled along with my node app?

@andrei-ce
Copy link

andrei-ce commented Feb 9, 2021

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)

@Tinbit
Copy link

Tinbit commented Feb 13, 2021

Following ... I Got the same issue installing "express": "^4.17.1",

@DBCOOPER90
Copy link

Following ... I Got the same issue installing "express": "^4.17.1",

Same Here. Not sure why this is still an issue

@ghost
Copy link

ghost commented Aug 27, 2021

Same issue here rip

@sscarduzio
Copy link

sscarduzio commented Oct 8, 2021

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.

@Hariharanu
Copy link

Hariharanu commented Apr 22, 2022

Kindly check if you have any unwanted imports in your component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests