How do I export / import a Javascript function into Cakephp?

Hi,

How do I export / import a Javascript function into Cakephp?

Do I need a JavaScript framework like Node or WebPack?

I have tried this with no luck:

1.js
export function ()

2.js
import * as function from './js/1.js';

What do you mean by “export / import a JavaScript function into Cakephp”? In general JavaScript runs on the client, and PHP runs on the server, so they don’t interact.

I know but since it doesn’t work, I thought something might be happening with CakePHP

Since it’s not even clear what you’re trying to do, it’s even less clear what “it doesn’t work” means, and therefore we have no way to tell you whether it’s in any way related to CakePHP or how to fix it. If you can provide more details about what you mean to accomplish, and what isn’t working about it, that may change.