Comments (22)
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.
What if I want express to be bundled along with my node app?
from netlify-express.
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.
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
from netlify-express.
Following ... I Got the same issue installing "express": "^4.17.1",
from netlify-express.
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.
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.
Kindly check if you have any unwanted imports in your component
from netlify-express.
any update on this issue. I get the same when I do yarn build?
from netlify-express.
Hey guys would be great to get some help on this - I am not sure how to solve this in the netlify functions context...
from netlify-express.
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.
I found the same issue.
from netlify-express.
Also having this issue
from netlify-express.
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.
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.
where is the webpack.config.js located?
from netlify-express.
It's your file. You create it in order to customize webpack. I suggest you check out the webpack tutorial here.
from netlify-express.
from netlify-express.
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.
Following ... I Got the same issue installing "express": "^4.17.1",
Same Here. Not sure why this is still an issue
from netlify-express.
Same issue here rip
from netlify-express.
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)
- sadly not working on local HOT 2
- Trying to connect to sql database got an error
- How to view console.log()'s? HOT 1
- Failed to lookup view "index" in views directory "/views" HOT 1
- Details about /.netlify Folder HOT 1
- Can not run it locally
- Only root route is working locally
- TypeScript Example HOT 1
- Giving errors while building on netlify? HOT 1
- Doesn't work with res.sendFile() and templates HOT 1
- Netlify-lambda deprecated
- this is not working build failed
- Only root route returns HOT 7
- Is this compatible with Gatsby somehow? HOT 3
- Function invocation failed: TypeError: require is not a function error HOT 1
- How can I use view engines?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from netlify-express.