Code Monkey home page Code Monkey logo

Comments (22)

ajay-whiz avatar ajay-whiz commented on May 31, 2024 42

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

from netlify-express.

frague avatar frague commented on May 31, 2024 14

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

from netlify-express.

joshgreifer avatar joshgreifer commented on May 31, 2024 9

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?

from netlify-express.

heshamelmasry77 avatar heshamelmasry77 commented on May 31, 2024 8

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

from netlify-express.

Tinbit avatar Tinbit commented on May 31, 2024 4

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

from netlify-express.

 avatar commented on May 31, 2024 3

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.

from netlify-express.

tuxianchao avatar tuxianchao commented on May 31, 2024 2

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

from netlify-express.

Hariharanu avatar Hariharanu commented on May 31, 2024 1

Kindly check if you have any unwanted imports in your component

from netlify-express.

dturton avatar dturton commented on May 31, 2024

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

from netlify-express.

ydennisy avatar ydennisy commented on May 31, 2024

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

from netlify-express.

neverendingqs avatar neverendingqs commented on May 31, 2024

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.

from netlify-express.

mikeyzhe avatar mikeyzhe commented on May 31, 2024

I found the same issue.

from netlify-express.

virgilCane avatar virgilCane commented on May 31, 2024

Also having this issue

from netlify-express.

csmper avatar csmper commented on May 31, 2024

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

from netlify-express.

hamidone avatar hamidone commented on May 31, 2024

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

from netlify-express.

neerujjain avatar neerujjain commented on May 31, 2024

where is the webpack.config.js located?

from netlify-express.

aaronleesmith avatar aaronleesmith commented on May 31, 2024

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

from netlify-express.

pz1996r avatar pz1996r commented on May 31, 2024

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

from netlify-express.

andrei-ce avatar andrei-ce commented on May 31, 2024

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)

from netlify-express.

DBCOOPER90 avatar DBCOOPER90 commented on May 31, 2024

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

Same Here. Not sure why this is still an issue

from netlify-express.

 avatar commented on May 31, 2024

Same issue here rip

from netlify-express.

sscarduzio avatar sscarduzio commented on May 31, 2024

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.

from netlify-express.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.