chriscourses / tower-defense

34 stars 25 forks source link

node_modules #1

Closed JanVeb closed 1 year ago

JanVeb commented 1 year ago

Hi there, really liked your project, though I never worked with vanila javascript project before, how can I import node_modules into it?

Wanna import https://github.com/qiao/PathFinding.js/ so i can change path dynamicaly in the game?

var PF = require("pathfinding"); //  require is not defined
import * as PF from "node_modules/pathfinding/visual/lib/pathfinding-browser.min.js"; //Uncaught SyntaxError: Cannot use import statement outside a module (at pathfinder.js:2:1)
import { Grid, Finder, AStarFinder } from "pathfinding";. // pathfinder.js:3 

       Uncaught SyntaxError: Cannot use import statement outside a module (at pathfinder.js:3:1)

Neither of this methods works

JanVeb commented 1 year ago

Solved it by converting code to react.js project