Skip to content

Requiring package via variable breaks package #160

@zhuyifang

Description

@zhuyifang

My operating environment is as follows:
macOS 11.23
electron 13.0.1

Run the following code in the main process of electron:

const FfmpegCommand = require('fluent-ffmpeg');
import {path as ffmpegPath} from'@ffmpeg-installer/ffmpeg';
command = new FfmpegCommand({
     source: item.m3u8
   });
command.setFfmpegPath(ffmpegPath)

node reported an error: not find XXXXX
XXXX is the value of npm3Package

After testing, it is caused by the use of variables in require,
In line 35 of the file @ffmpeg-installer/ffmpeg/index.js:
packageJson = require(npm3Package);
I modified it to:
packageJson = require(''+npm3Package);
The program can run normally, so...

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions