I know there were some of this topics, but I didn't find the solution for my problem.
I've tried to include this lib: https://github.com/euoia/hex-grid.js#new_module_hex-grid--HexGrid_new unfortunatelly I couldn't.
I put the unzipped project into src/js folder. Into angular-cli.json inside the scripts tag I put the url to the hex-grid.js: "scripts": ["js/hex-grid.js-master/src/hex-grid.js"]. the route is good, because the app was compiled succesfully. I have a game-map.component.ts file where I want to use this lib.
import {Component} from '@angular/core';
declare var hexGrid: any;
@Component({
selector: 'app-game-map',
templateUrl: './game-map.component.html',
styleUrls: ['./game-map.component.css']
})
export class GameMapComponent {
hex: any;
constructor() {
this.hex = new hexGrid({
width: 20,
height: 10,
orientation: 'flat-topped',
layout: 'odd-q'
});
}
}
But I got this error: Uncaught ReferenceError: module is not defined at scripts.bundle.js:2
And it has problem with this module: module.exports = (function () { /**
Someone can help me in this issue? Thanks!
1.install npm install hex-grid.js in cmd
2.import * as hexGrid from 'hex-grid.js'
3.then use it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With