This issue only occurs when using love.js.
I have a game, with a filetree like this:
game/
├── main.lua
└── game.lua
When I attempt to import game.lua from main.lua...
Game = require 'game'
I get the error:
Error: main.lua:1: module 'game' not found:
love.js:9 no field package.preload['game']
love.js:9 no 'game' in LOVE game directories.
love.js:9 no file 'game' in LOVE paths.
...
However, when I rename my game folder to something else (like src), it works fine.
Took me forever to figure this out, now it's not much of a problem for me.
This issue only occurs when using love.js. I have a game, with a filetree like this:
When I attempt to import game.lua from main.lua...
I get the error:
However, when I rename my
game
folder to something else (likesrc
), it works fine. Took me forever to figure this out, now it's not much of a problem for me.Here is how I packaged my game: