A webpack plugin for compiling javascript files into a TIC-80 game cartridge
Add the plugin to the plugins array in webpack.config.js:
// webpack.config.js
const Tic80Plugin = require('tic80-webpack-plugin');
module.exports = {
plugins: [
new Tic80Plugin()
]
};
In order for TIC-80 to pick up the exported functions, the libraryType
must be 'global'
and the globalObject
must be 'this'
:
// game's entry point
function TIC() { ... }
module.exports = {
TIC
}
// webpack.config.js
module.exports = {
output: {
libraryType: 'global',
globalObject: 'this'
}
};
Additionally, the output bundle should have the ".js" extension and the input cartridge file should be generated by running save [cart name].js
in TIC-80 (this saves the game data as javascript comments).
The constructor takes an object with the following properties:
Property | Required | Default | Description |
---|---|---|---|
cartridgePath |
false |
cartridge.js |
Path from the current Webpack context to the game cartridge file |
See LICENSE