Question: I'm bundling a typescript project, and webpack fails with the error
`ERROR in (webpack)/lib/NormalModule.js
Module not found: Error: Can't resolve 'module' in 'C:\SPA\MyApp\node_modules\webpack\lib'
 @ (webpack)/lib/NormalModule.js 91:16-33`

If I hack the module from 
`var Module = require("module");`
to 
`var Module = require("./module");` 
the problem is resolved.

Does anyone have any idea what might be causing this to be an issue? It seems odd that nobody else is reporting this as an issue.
The line in question is here:
<https://github.com/webpack/webpack/blob/master/lib/NormalModule.js#L90>

Answer: 
For a beginner the following would be enough.

```
├── Gemfile
├── Gemfile.lock
├── app.rb
├── config.rb
└── lib/
    ├── lib1.rb
    ├── lib2.rb

```

where app.rb is you main file and you run the project using

ruby app.rb

lib/
has you library files lib1.rb and lib2.rb

suppose you are tweeting through your app then lib1.rb could be tweet.rb
"It uses constants and global variables." Oh, no, please, don't do this. You're making your life needlessly difficult.

You really need to avoid using global constants and variables unless you literally have no other option. They're extremely difficult to keep orderly and tend to cause chaos in any non-trivial program.

Organize everything in your program into one or more `module` or `class` definitions. Give them meaningful names. You'll use a `module` for "collection of method" containers, `class` for something that encapsulates a process or an entity of some sort.

This distinction is sometimes hard to make, but thinking about the problem carefully and trying different approaches will be necessary to do it properly.

The basics of my Ruby code are a directory called `bin/` for any sort of executables, `lib/` for the library files, `test/` for testing code, and a `README` file to explain what it all does. The last two are especially important as untested code is nothing but trouble, and undocumented code is even worse.

You'll only need a `Rakefile` if you have some kind of processes you need to perform on a routine basis. Packaging a `gem` is one such thing, or as with Rails, managing database migrations. Most projects don't need one of these, but it's sometimes helpful to include one that simply runs tests or produces documentation.

The format of a `Rakefile` is super simple, and there are literally millions of examples out there. Find one that does what you need and adapt it to your particular structure.