love.js
love.js copied to clipboard
[BUG] Cannot import file with same name as game's parent folder
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.
Here is how I packaged my game:
love.js game .packaged -t game -c
@Davidobot