The check engine light is key here and should point you in the right direction.
It sounds like you’ve taken care of the spark side of things.
This issue could also be related to fuel delivery, air intake, the fuel/air mixture, or a timing related sensor. Examine the vacuum hose for your fuel pressure regulator. A fuel pressure test may be helpful to ensure proper pressure is attained and maintained by the fuel pump and pressure regulator. Professionally done is best but if you do it yourself take proper safety precautions and have fire control equipment handy. There is also the possibility of a faulty oxygen sensor throwing off the fuel/air ratio, or a camshaft position sensor or crankshaft position sensor negatively affecting the timing.