B
B
bob_meister2021-07-04 10:22:39
npm
bob_meister, 2021-07-04 10:22:39

How to connect packages from node_modules to Laravel?

I am using Laravel 8. NodeJS installed.
I want to install a CSGO demo parser on the site .

I put the package.
npm i demofile

In Laravel, in the app.js file which is in the resources, I put the line: On the page in the github there is an example in which packages are imported at the beginning:
require('demofile');

import fs = require("fs");
import demofile = require("demofile");

As you can see, the "fs" package is needed, but it seems to no longer exist, I found "fs-extra". Also set.

But these imports throw errors Cannot use import statement outside a module.
How can I attach them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pLavrenov, 2021-07-04
@pLavrenov

import demofile from 'demofile';
npm run prod (build the build)
npm run watch (for development)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question