Answer the question
In order to leave comments, you need to log in
How to make friends between webpack and default node modules?
By default nodes, I mean those that are provided to us immediately after installing nodejs, for example, fs, http, net, etc.
There are files that will be bundled into one using webpack, and if I want to do something like this in these files, I
will get something like thislet net = require('net');
ERROR in *какой-то файл*
Module not found: Error: Can't resolve 'net' in '*какой-то путь*'
@ *какой-то файл* 27:10-24
Answer the question
In order to leave comments, you need to log in
Tell webpack that you are building an app for electron.
https://webpack.js.org/configuration/target/
When visiting a site, the browser sends a piece of text information (called an HTTP request) over the network to the server, which, among other things, contains lines like:
GET /PAGE/ HTTP/1.0
Host: www.website.net
The fact is that the URI does not have to be projected onto the file system, that is, www.website.net does not have to have a PAGE directory, it's just that this behavior is set by default. Google mod_rewrite
Formally, this is called CNC, and I strongly do not recommend using mod_rewrite to implement it, it is better to implement the router at the php level, and then there will be fewer problems with transferring, say, from apache to nginx. Just redirect all requests to index.php, and then let php handle it.
And start using ready-made things already, there are micro-frameworks and so on, where all this has long been implemented ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question