Skip to content

Support Webpack, don't use require.resolve() #76

@quintesse

Description

@quintesse

Is your feature request related to a problem? Please describe.

Because of the use of the function require.resolve() in this code: https://github.com/opengovsg/pdf2md/blob/master/lib/util/pdf.js#L19 the use of pdf2md in my project results in errors in production builds at runtime. The project uses WebPack to bundle the code and that particular function cannot be used.

An explanation of the problem can be found in this Webpack issue: webpack/webpack#13931

(It's basically because once a project has been bundled, asking a module for it's filename just doesn't make sense anymore)

Describe the solution you'd like

I'd like the code to either not use that method by using an alternative or provide some kind of option/flag that avoids its use.
Also, given the fact that this project is about converting a PDF file to Markdown, which is text-only, is providing font directories even useful? Would it perhaps be possible to do without?

Describe alternatives you've considered

The work-around mentioned in the Webpack issue fortunately works. It's a completely incidental fix that reduces runtime code efficiency, so I'd prefer not to use it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions